Skip to contentSkip to conversation

check for cdrom file on device reconfigure

PATCH In review Miroslav Rezanina 2 participants 2 messages Oct 26, 2010 – Oct 28, 2010 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 check for cdrom file on device reconfigure

In reply to a message not in the archive

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.

--

tools/python/xen/xend/server/blkif.py +5 -0
diff -r 3c4c3d48a835 tools/python/xen/xend/server/blkif.py
@@ -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'],
Signature · 2 lines
Miroslav Rezanina
Software Engineer - Virtualization Team - XEN kernel
#2 lore raw

Miroslav Rezanina writes ("[Xen-devel] [PATCH] check for cdrom file on device reconfigure"):

Quoted 4 lines

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.

I'm not convinced that this is the right approach. Surely what should happen is that errors that qemu experiences trying to open the cdrom should be propagated through xenstore and back through the toolstack to the user.

Ian.