[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • 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
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.