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

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

 



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@xxxxxxxxxx>
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 &&
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]