]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: add "-boot strict" to commandline whenever possible
authorLaine Stump <laine@laine.org>
Mon, 2 Dec 2013 12:07:12 +0000 (14:07 +0200)
committerLaine Stump <laine@laine.org>
Tue, 3 Dec 2013 09:58:26 +0000 (11:58 +0200)
This resolves:

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

(which was already closed as CANTFIX because the qemu "-boot strict"
commandline option wasn't available at the time).

Problem: you couldn't have a domain that used PXE to boot, but also
had an un-bootable disk device *even if that disk wasn't listed in the
boot order*, because if PXE timed out (e.g. due to the bridge
forwarding delay), the BIOS would move on to the next target, which
would be the unbootable disk device (again - even though it wasn't
given a boot order), and get stuck at a "BOOT DISK FAILURE, PRESS ANY
KEY" message until a user intervened.

The solution available since sometime around QEMU 1.5, is to add
"-boot strict=on" to *every* qemu command. When this is done, if any
devices have a boot order specified, then QEMU will *only* attempt to
boot from those devices that have an explicit boot order, ignoring the
rest.

src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h
src/qemu/qemu_command.c
tests/qemucapabilitiesdata/caps_1.5.3-1.caps
tests/qemucapabilitiesdata/caps_1.6.0-1.caps
tests/qemucapabilitiesdata/caps_1.6.50-1.caps
tests/qemuxml2argvtest.c

index 548b988713504779eba3dfd05d70e984b0b3913e..a68e555dc8d6c3a9ae9c34c3c3ef3e2319c831f1 100644 (file)
@@ -243,6 +243,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "virtio-mmio",
               "ich9-intel-hda",
               "kvm-pit-lost-tick-policy",
+
+              "boot-strict", /* 160 */
     );
 
 struct _virQEMUCaps {
@@ -2279,6 +2281,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
     { "machine", "mem-merge", QEMU_CAPS_MEM_MERGE },
     { "drive", "discard", QEMU_CAPS_DRIVE_DISCARD },
     { "realtime", "mlock", QEMU_CAPS_MLOCK },
+    { "boot-opts", "strict", QEMU_CAPS_BOOT_STRICT },
 };
 
 static int
index 02d47c680b4ce24c14d1e268a57364c2e425070b..aea64ea146161c83228d8046f494761940a4adab 100644 (file)
@@ -198,6 +198,7 @@ enum virQEMUCapsFlags {
     QEMU_CAPS_DEVICE_VIRTIO_MMIO = 157, /* -device virtio-mmio */
     QEMU_CAPS_DEVICE_ICH9_INTEL_HDA = 158, /* -device ich9-intel-hda */
     QEMU_CAPS_KVM_PIT_TICK_POLICY = 159, /* kvm-pit.lost_tick_policy */
+    QEMU_CAPS_BOOT_STRICT        = 160, /* -boot strict */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
index 2ad995655718e328e31d4a0afc7e6265f3cbc564..768fdc4b8c2fc1f13ec1ae4c882000501b675961 100644 (file)
@@ -8229,6 +8229,12 @@ qemuBuildCommandLine(virConnectPtr conn,
                               def->os.bios.rt_delay);
         }
 
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_STRICT)) {
+            if (boot_nparams++)
+                virBufferAddChar(&boot_buf, ',');
+            virBufferAddLit(&boot_buf, "strict=on");
+        }
+
         if (boot_nparams > 0) {
             virCommandAddArg(cmd, "-boot");
 
index 09cf657f14efe7406706b3e16988f0e8a54e9c67..2b0044965e36dcde395aeb40a8acb3b1c59f92dc 100644 (file)
     <flag name='usb-storage.removable'/>
     <flag name='ich9-intel-hda'/>
     <flag name='kvm-pit-lost-tick-policy'/>
+    <flag name='boot-strict'/>
   </qemuCaps>
index 33ee73bec3564368b4f071b15213b3623c8bca4b..7bce4aa0642b18b6eac718f2ae132354c575735d 100644 (file)
     <flag name='virtio-mmio'/>
     <flag name='ich9-intel-hda'/>
     <flag name='kvm-pit-lost-tick-policy'/>
+    <flag name='boot-strict'/>
   </qemuCaps>
index a66034a8a29a6d028cdf74f0d3eb0ac705cd00f4..bfaab9d2ce1959c413314c2e7f71fab63e79d932 100644 (file)
     <flag name='virtio-mmio'/>
     <flag name='ich9-intel-hda'/>
     <flag name='kvm-pit-lost-tick-policy'/>
+    <flag name='boot-strict'/>
   </qemuCaps>
index e9a32fbf9d832f66d8ad6c9da2fd157827d8791b..f9abf1bb499c6fc04a076301bba0566e4c088272 100644 (file)
@@ -600,6 +600,10 @@ mymain(void)
             QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT,
             QEMU_CAPS_BOOTINDEX,
             QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
+    DO_TEST("boot-strict",
+            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT,
+            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_BOOT_STRICT,
+            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
     DO_TEST("bootloader", QEMU_CAPS_DOMID, QEMU_CAPS_KVM);
 
     DO_TEST("reboot-timeout-disabled", QEMU_CAPS_REBOOT_TIMEOUT);