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

[libvirt] PATCH: Fix booting QEMU off CDROM



KVM supports an alternate syntax for indicating a boot device when the
-drive parameter is available. Instead of -boot c, it allow 'boot=on'
to be set for the -drive parameter. Unfortauntely it turns that this
doesn't work with certain CDROM images, in particular Fedora 9

https://bugzilla.redhat.com/show_bug.cgi?id=452355

Discussion with upstream indicates we're lucky it ever worked at all for 
CDROM media. So this patch removes use of the boot=on flag for CDROM devices.

NB, even when we added boot=on, we always still added -boot d param too,
so merely removing the boot=on flag is sufficient to make it work again.

 src/qemu_conf.c                                                |    3 -
 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.args |    1 
 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml  |   26 ++++++++++
 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.args  |    1 
 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml   |   26 ++++++++++
 tests/qemuxml2argvtest.c                                       |    4 +
 6 files changed, 60 insertions(+), 1 deletion(-)

Daniel

diff -rupN libvirt-0.4.4.orig/src/qemu_conf.c libvirt-0.4.4.new/src/qemu_conf.c
--- libvirt-0.4.4.orig/src/qemu_conf.c	2008-06-19 14:15:02.000000000 +0100
+++ libvirt-0.4.4.new/src/qemu_conf.c	2008-07-08 12:24:07.000000000 +0100
@@ -2616,7 +2616,8 @@ int qemudBuildCommandLine(virConnectPtr 
                      disk->src, qemudBusIdToName(disk->bus, 1),
                      media ? media : "",
                      idx,
-                     bootable ? ",boot=on" : "");
+                     bootable && disk->device == QEMUD_DISK_DISK
+                     ? ",boot=on" : "");
 
             ADD_ARG_LIT("-drive");
             ADD_ARG_LIT(opt);
diff -rupN libvirt-0.4.4.orig/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.args libvirt-0.4.4.new/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.args
--- libvirt-0.4.4.orig/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.args	1970-01-01 01:00:00.000000000 +0100
+++ libvirt-0.4.4.new/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.args	2008-07-08 12:25:59.000000000 +0100
@@ -0,0 +1 @@
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot d -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0 -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -rupN libvirt-0.4.4.orig/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml libvirt-0.4.4.new/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml
--- libvirt-0.4.4.orig/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml	1970-01-01 01:00:00.000000000 +0100
+++ libvirt-0.4.4.new/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml	2008-07-08 12:20:42.000000000 +0100
@@ -0,0 +1,26 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='cdrom'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+    </disk>
+  </devices>
+</domain>
diff -rupN libvirt-0.4.4.orig/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.args libvirt-0.4.4.new/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.args
--- libvirt-0.4.4.orig/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.args	1970-01-01 01:00:00.000000000 +0100
+++ libvirt-0.4.4.new/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.args	2008-07-08 12:13:15.000000000 +0100
@@ -0,0 +1 @@
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -rupN libvirt-0.4.4.orig/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml libvirt-0.4.4.new/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml
--- libvirt-0.4.4.orig/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml	1970-01-01 01:00:00.000000000 +0100
+++ libvirt-0.4.4.new/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml	2008-07-08 12:12:41.000000000 +0100
@@ -0,0 +1,26 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+    </disk>
+  </devices>
+</domain>
diff -rupN libvirt-0.4.4.orig/tests/qemuxml2argvtest.c libvirt-0.4.4.new/tests/qemuxml2argvtest.c
--- libvirt-0.4.4.orig/tests/qemuxml2argvtest.c	2008-06-02 10:16:46.000000000 +0100
+++ libvirt-0.4.4.new/tests/qemuxml2argvtest.c	2008-07-08 12:21:53.000000000 +0100
@@ -158,6 +158,10 @@ mymain(int argc, char **argv)
             QEMUD_CMD_FLAG_DRIVE_BOOT);
     DO_TEST("disk-xenvbd", QEMUD_CMD_FLAG_DRIVE |
             QEMUD_CMD_FLAG_DRIVE_BOOT);
+    DO_TEST("disk-drive-boot-disk", QEMUD_CMD_FLAG_DRIVE |
+            QEMUD_CMD_FLAG_DRIVE_BOOT);
+    DO_TEST("disk-drive-boot-cdrom", QEMUD_CMD_FLAG_DRIVE |
+            QEMUD_CMD_FLAG_DRIVE_BOOT);
     DO_TEST("graphics-vnc", 0);
     DO_TEST("graphics-sdl", 0);
     DO_TEST("input-usbmouse", 0);


-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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