WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] check for cdrom file on device reconfigure

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] check for cdrom file on device reconfigure
From: Miroslav Rezanina <mrezanin@xxxxxxxxxx>
Date: Tue, 26 Oct 2010 03:40:16 -0400 (EDT)
Delivery-date: Tue, 26 Oct 2010 00:41:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <372543940.373181288078681968.JavaMail.root@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
When guest is started with non-existing file specified as cdrom device, 
error is reported. However, when we try to use block-configure to change 
cdrom to non-existing file, command is executed successfully although 
qemu can't open this file.
Following patch checks if we can read specified file and raise error
when this is not possible.

Signed-off-by: Miroslav Rezanina <mrezanin@xxxxxxxxxx>
--
diff -r 3c4c3d48a835 tools/python/xen/xend/server/blkif.py
--- a/tools/python/xen/xend/server/blkif.py     Thu Aug 26 11:16:56 2010 +0100
+++ b/tools/python/xen/xend/server/blkif.py     Tue Oct 26 09:13:28 2010 +0200
@@ -130,6 +130,11 @@
 
         if (dev_type == 'cdrom' and new_front['device-type'] == 'cdrom' and
             dev == new_back['dev'] and mode == 'r'):
+
+            # check if can't access device file
+            if not os.access(new_back['params'],os.R_OK):
+               raise VmError("Can't open file %s" % new_back['params'])
+
             # dummy device
             self.writeBackend(devid,
                               'type', new_back['type'],
-- 
Miroslav Rezanina
Software Engineer - Virtualization Team - XEN kernel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>