]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix booting QEMU off CDROM devices with -drive arg
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 11 Jul 2008 09:56:23 +0000 (09:56 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 11 Jul 2008 09:56:23 +0000 (09:56 +0000)
ChangeLog
src/qemu_conf.c
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

index 56ef667ec46d59a2062e7a1081c1efa2949a199d..c7199615faef5d33d585dd06a62a64a218133f18 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Jul 11 10:55:59 BST 2008 Daniel P. Berrange <berrange@redhat.com>
+
+       * src/qemu_conf.c: Fix booting off CDROM devices
+       * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-*,
+       tests/qemuxml2argvtest.c: New test cases for booting off
+       CDROM with QEMU
+
 Fri Jul 11 10:50:59 BST 2008 Daniel P. Berrange <berrange@redhat.com>
 
        * libvirt.spec.in, qemud/Makefile.am: Rename installed polkit
index 4b8c01ecaefad3328a9fd65beebf7350e8909618..82797aa32136113c30fe5922c2cdabe0426f2e72 100644 (file)
@@ -2624,7 +2624,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
                      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 --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.args
new file mode 100644 (file)
index 0000000..22fe65c
--- /dev/null
@@ -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 --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml
new file mode 100644 (file)
index 0000000..fdbf2b8
--- /dev/null
@@ -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 --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.args
new file mode 100644 (file)
index 0000000..7f2c4eb
--- /dev/null
@@ -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 --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml
new file mode 100644 (file)
index 0000000..b8ff06a
--- /dev/null
@@ -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>
index be43bb58fa5e99769001c178a218d83f0c897944..336a113f1c7e920f99c83c7e5334b2648c3789ef 100644 (file)
@@ -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);