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

[libvirt] [PATCH]: Fix Qemu CD-ROM with no source



The new generic domain re-factor introduced a small regression into the drive
handling code.  In particular, if you had a section of XML like:

    <disk type='file' device='cdrom'>
      <target dev='hdc' bus='ide'/>
      <readonly/>
    </disk>

This used to work with older libvirt, but now fails.  This is because we are
actually passing the literal string (null) to the qemu command-line, which qemu
barfs on.  This patch fixes it up by making it blank, which allows qemu to
continue on it's merry way.

Signed-off-by: Chris Lalancette <clalance redhat com>
Index: src/qemu_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.c,v
retrieving revision 1.85
diff -u -r1.85 qemu_conf.c
--- a/src/qemu_conf.c	25 Jul 2008 09:31:24 -0000	1.85
+++ b/src/qemu_conf.c	29 Jul 2008 09:55:56 -0000
@@ -888,13 +888,11 @@
                 goto error;
             }
 
-            if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
-                media = "media=cdrom,";
-
             switch (disk->device) {
             case VIR_DOMAIN_DISK_DEVICE_CDROM:
                 bootable = bootCD;
                 bootCD = 0;
+                media = "media=cdrom,";
                 break;
             case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
                 bootable = bootFloppy;
@@ -907,7 +905,7 @@
             }
 
             snprintf(opt, PATH_MAX, "file=%s,if=%s,%sindex=%d%s",
-                     disk->src, bus,
+                     disk->src ? disk->src : "", bus,
                      media ? media : "",
                      idx,
                      bootable &&

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