]> xenbits.xensource.com Git - libvirt.git/commitdiff
Remove bootloader option from QEMU
authorJán Tomko <jtomko@redhat.com>
Wed, 18 Feb 2015 15:08:40 +0000 (16:08 +0100)
committerJán Tomko <jtomko@redhat.com>
Mon, 2 Mar 2015 06:39:09 +0000 (07:39 +0100)
It was only supported by xenner (since commit 763a59d8),
for which we removed support in commit de9be0a.

Remove the code generating this command line option,
refuse to parse it and delete the outdated tests.

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

src/qemu/qemu_command.c
src/qemu/qemu_domain.c
tests/qemuxml2argvdata/qemuxml2argv-bootloader.args [deleted file]
tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml [deleted file]
tests/qemuxml2argvdata/qemuxml2argv-input-xen.args [deleted file]
tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml [deleted file]
tests/qemuxml2argvtest.c
tests/qemuxml2xmltest.c

index 24b2ad95b4e21200f3e56fa8fb5f8b0ecbe2adc0..32f17aa9fa3ed99675ffa3e2a7e187784d8062c4 100644 (file)
@@ -8251,6 +8251,8 @@ qemuBuildCommandLine(virConnectPtr conn,
     };
     virArch hostarch = virArchFromHost();
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+    virBuffer boot_buf = VIR_BUFFER_INITIALIZER;
+    int boot_nparams = 0;
 
     VIR_DEBUG("conn=%p driver=%p def=%p mon=%p json=%d "
               "qemuCaps=%p migrateFrom=%s migrateFD=%d "
@@ -8769,148 +8771,140 @@ qemuBuildCommandLine(virConnectPtr conn,
                                def->pm.s4 == VIR_TRISTATE_BOOL_NO);
     }
 
-    if (!def->os.bootloader) {
-        int boot_nparams = 0;
-        virBuffer boot_buf = VIR_BUFFER_INITIALIZER;
-        /*
-         * We prefer using explicit bootindex=N parameters for predictable
-         * results even though domain XML doesn't use per device boot elements.
-         * However, we can't use bootindex if boot menu was requested.
+    /*
+     * We prefer using explicit bootindex=N parameters for predictable
+     * results even though domain XML doesn't use per device boot elements.
+     * However, we can't use bootindex if boot menu was requested.
+     */
+    if (!def->os.nBootDevs) {
+        /* def->os.nBootDevs is guaranteed to be > 0 unless per-device boot
+         * configuration is used
          */
-        if (!def->os.nBootDevs) {
-            /* def->os.nBootDevs is guaranteed to be > 0 unless per-device boot
-             * configuration is used
-             */
-            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("hypervisor lacks deviceboot feature"));
-                goto error;
-            }
-            emitBootindex = true;
-        } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) &&
-                   (def->os.bootmenu != VIR_TRISTATE_BOOL_YES ||
-                    !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU))) {
-            emitBootindex = true;
-        }
-
-        if (!emitBootindex) {
-            char boot[VIR_DOMAIN_BOOT_LAST+1];
-
-            for (i = 0; i < def->os.nBootDevs; i++) {
-                switch (def->os.bootDevs[i]) {
-                case VIR_DOMAIN_BOOT_CDROM:
-                    boot[i] = 'd';
-                    break;
-                case VIR_DOMAIN_BOOT_FLOPPY:
-                    boot[i] = 'a';
-                    break;
-                case VIR_DOMAIN_BOOT_DISK:
-                    boot[i] = 'c';
-                    break;
-                case VIR_DOMAIN_BOOT_NET:
-                    boot[i] = 'n';
-                    break;
-                default:
-                    boot[i] = 'c';
-                    break;
-                }
-            }
-            boot[def->os.nBootDevs] = '\0';
-
-            virBufferAsprintf(&boot_buf, "%s", boot);
-            boot_nparams++;
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("hypervisor lacks deviceboot feature"));
+            goto error;
         }
+        emitBootindex = true;
+    } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) &&
+               (def->os.bootmenu != VIR_TRISTATE_BOOL_YES ||
+                !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU))) {
+        emitBootindex = true;
+    }
 
-        if (def->os.bootmenu) {
-            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU)) {
-                if (boot_nparams++)
-                    virBufferAddChar(&boot_buf, ',');
+    if (!emitBootindex) {
+        char boot[VIR_DOMAIN_BOOT_LAST+1];
 
-                if (def->os.bootmenu == VIR_TRISTATE_BOOL_YES)
-                    virBufferAddLit(&boot_buf, "menu=on");
-                else
-                    virBufferAddLit(&boot_buf, "menu=off");
-            } else {
-                /* We cannot emit an error when bootmenu is enabled but
-                 * unsupported because of backward compatibility */
-                VIR_WARN("bootmenu is enabled but not "
-                         "supported by this QEMU binary");
+        for (i = 0; i < def->os.nBootDevs; i++) {
+            switch (def->os.bootDevs[i]) {
+            case VIR_DOMAIN_BOOT_CDROM:
+                boot[i] = 'd';
+                break;
+            case VIR_DOMAIN_BOOT_FLOPPY:
+                boot[i] = 'a';
+                break;
+            case VIR_DOMAIN_BOOT_DISK:
+                boot[i] = 'c';
+                break;
+            case VIR_DOMAIN_BOOT_NET:
+                boot[i] = 'n';
+                break;
+            default:
+                boot[i] = 'c';
+                break;
             }
         }
+        boot[def->os.nBootDevs] = '\0';
 
-        if (def->os.bios.rt_set) {
-            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_REBOOT_TIMEOUT)) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("reboot timeout is not supported "
-                                 "by this QEMU binary"));
-                virBufferFreeAndReset(&boot_buf);
-                goto error;
-            }
+        virBufferAsprintf(&boot_buf, "%s", boot);
+        boot_nparams++;
+    }
 
+    if (def->os.bootmenu) {
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU)) {
             if (boot_nparams++)
                 virBufferAddChar(&boot_buf, ',');
 
-            virBufferAsprintf(&boot_buf,
-                              "reboot-timeout=%d",
-                              def->os.bios.rt_delay);
+            if (def->os.bootmenu == VIR_TRISTATE_BOOL_YES)
+                virBufferAddLit(&boot_buf, "menu=on");
+            else
+                virBufferAddLit(&boot_buf, "menu=off");
+        } else {
+            /* We cannot emit an error when bootmenu is enabled but
+             * unsupported because of backward compatibility */
+            VIR_WARN("bootmenu is enabled but not "
+                     "supported by this QEMU binary");
         }
+    }
 
-        if (def->os.bm_timeout_set) {
-            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPLASH_TIMEOUT)) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("splash timeout is not supported "
-                                 "by this QEMU binary"));
-                virBufferFreeAndReset(&boot_buf);
-                goto error;
-            }
+    if (def->os.bios.rt_set) {
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_REBOOT_TIMEOUT)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("reboot timeout is not supported "
+                             "by this QEMU binary"));
+            goto error;
+        }
 
-            if (boot_nparams++)
-                virBufferAddChar(&boot_buf, ',');
+        if (boot_nparams++)
+            virBufferAddChar(&boot_buf, ',');
 
-            virBufferAsprintf(&boot_buf, "splash-time=%u", def->os.bm_timeout);
-        }
+        virBufferAsprintf(&boot_buf,
+                          "reboot-timeout=%d",
+                          def->os.bios.rt_delay);
+    }
 
-        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_STRICT)) {
-            if (boot_nparams++)
-                virBufferAddChar(&boot_buf, ',');
-            virBufferAddLit(&boot_buf, "strict=on");
+    if (def->os.bm_timeout_set) {
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPLASH_TIMEOUT)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("splash timeout is not supported "
+                             "by this QEMU binary"));
+            goto error;
         }
 
-        if (boot_nparams > 0) {
-            virCommandAddArg(cmd, "-boot");
+        if (boot_nparams++)
+            virBufferAddChar(&boot_buf, ',');
 
-            if (virBufferCheckError(&boot_buf) < 0)
-                goto error;
+        virBufferAsprintf(&boot_buf, "splash-time=%u", def->os.bm_timeout);
+    }
 
-            if (boot_nparams < 2 || emitBootindex) {
-                virCommandAddArgBuffer(cmd, &boot_buf);
-                virBufferFreeAndReset(&boot_buf);
-            } else {
-                char *str = virBufferContentAndReset(&boot_buf);
-                virCommandAddArgFormat(cmd,
-                                       "order=%s",
-                                       str);
-                VIR_FREE(str);
-            }
+    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");
+
+        if (virBufferCheckError(&boot_buf) < 0)
+            goto error;
+
+        if (boot_nparams < 2 || emitBootindex) {
+            virCommandAddArgBuffer(cmd, &boot_buf);
+            virBufferFreeAndReset(&boot_buf);
+        } else {
+            char *str = virBufferContentAndReset(&boot_buf);
+            virCommandAddArgFormat(cmd,
+                                   "order=%s",
+                                   str);
+            VIR_FREE(str);
         }
+    }
 
-        if (def->os.kernel)
-            virCommandAddArgList(cmd, "-kernel", def->os.kernel, NULL);
-        if (def->os.initrd)
-            virCommandAddArgList(cmd, "-initrd", def->os.initrd, NULL);
-        if (def->os.cmdline)
-            virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
-        if (def->os.dtb) {
-            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB)) {
-                virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);
-            } else {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("dtb is not supported with this QEMU binary"));
-                goto error;
-            }
+    if (def->os.kernel)
+        virCommandAddArgList(cmd, "-kernel", def->os.kernel, NULL);
+    if (def->os.initrd)
+        virCommandAddArgList(cmd, "-initrd", def->os.initrd, NULL);
+    if (def->os.cmdline)
+        virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
+    if (def->os.dtb) {
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB)) {
+            virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);
+        } else {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("dtb is not supported with this QEMU binary"));
+            goto error;
         }
-    } else {
-        virCommandAddArgList(cmd, "-bootloader", def->os.bootloader, NULL);
     }
 
     for (i = 0; i < def->ncontrollers; i++) {
@@ -10383,6 +10377,7 @@ qemuBuildCommandLine(virConnectPtr conn,
     return cmd;
 
  error:
+    virBufferFreeAndReset(&boot_buf);
     virObjectUnref(cfg);
     /* free up any resources in the network driver
      * but don't overwrite the original error */
index ac5ca74a83786c8326bc20145dd1048702361ab9..2ab9f3b5e592641e96a219fbce3d3bcb8531eb01 100644 (file)
@@ -925,6 +925,12 @@ qemuDomainDefPostParse(virDomainDefPtr def,
     bool addDefaultUSBKBD = false;
     bool addDefaultUSBMouse = false;
 
+    if (def->os.bootloader || def->os.bootloaderArgs) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("bootloader is not supported by QEMU"));
+        return -1;
+    }
+
     /* check for emulator and create a default one if needed */
     if (!def->emulator &&
         !(def->emulator = virDomainDefGetDefaultEmulator(def, caps)))
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-bootloader.args b/tests/qemuxml2argvdata/qemuxml2argv-bootloader.args
deleted file mode 100644 (file)
index d7c4139..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/xenner -S \
--M xenner -m 214 -smp 1 -domid 6 -nographic -monitor unix:/tmp/test-monitor,\
-server,nowait -no-acpi -bootloader /usr/bin/pygrub -usb -cdrom /dev/cdrom -net none \
--serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml b/tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml
deleted file mode 100644 (file)
index 3b4c2bd..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<domain type='kvm'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219100</memory>
-  <currentMemory unit='KiB'>219100</currentMemory>
-  <vcpu placement='static'>1</vcpu>
-  <bootloader>/usr/bin/pygrub</bootloader>
-  <os>
-    <type arch='x86_64' machine='xenner'>xen</type>
-  </os>
-  <clock offset='utc'/>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>destroy</on_crash>
-  <devices>
-    <emulator>/usr/bin/xenner</emulator>
-    <disk type='block' device='cdrom'>
-      <source dev='/dev/cdrom'/>
-      <target dev='hdc' bus='ide'/>
-      <readonly/>
-      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
-    </disk>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-input-xen.args b/tests/qemuxml2argvdata/qemuxml2argv-input-xen.args
deleted file mode 100644 (file)
index 8c336bd..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/xenner -S -M xenner -m 214 -smp 1 -domid 6 -monitor \
-unix:/tmp/test-monitor,server,nowait -no-acpi -bootloader /foo -usb -hda \
-/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -vnc \
-127.0.0.1:3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml b/tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml
deleted file mode 100644 (file)
index a19fe4f..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<domain type='kvm'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</currentMemory>
-  <vcpu placement='static'>1</vcpu>
-  <bootloader>/foo</bootloader>
-  <os>
-    <type arch='x86_64' machine='xenner'>xen</type>
-  </os>
-  <clock offset='utc'/>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>destroy</on_crash>
-  <devices>
-    <emulator>/usr/bin/xenner</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
-    <input type='mouse' bus='xen'/>
-    <input type='keyboard' bus='xen'/>
-    <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'>
-      <listen type='address' address='127.0.0.1'/>
-    </graphics>
-    <video>
-      <model type='xen' vram='4096' heads='1'/>
-    </video>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
index 7eba5c95fb9f67889cfccc5dc7b51c8c36c8f82e..50283862c78b5ff34d845e7756b6fb8a94c04b46 100644 (file)
@@ -647,7 +647,6 @@ mymain(void)
             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);
     DO_TEST("reboot-timeout-enabled", QEMU_CAPS_REBOOT_TIMEOUT);
@@ -970,7 +969,6 @@ mymain(void)
 
     DO_TEST("input-usbmouse", NONE);
     DO_TEST("input-usbtablet", NONE);
-    DO_TEST("input-xen", QEMU_CAPS_DOMID, QEMU_CAPS_KVM, QEMU_CAPS_VNC);
     DO_TEST("misc-acpi", NONE);
     DO_TEST("misc-disable-s3", QEMU_CAPS_DISABLE_S3);
     DO_TEST("misc-disable-suspends", QEMU_CAPS_DISABLE_S3, QEMU_CAPS_DISABLE_S4);
index 99d46299af41540811161a2f0f562df11b6d0d09..58917c33e8efb074cff11931d053e7300e7f5faa 100644 (file)
@@ -178,7 +178,6 @@ mymain(void)
     DO_TEST("boot-menu-disable");
     DO_TEST_DIFFERENT("boot-menu-disable-with-timeout");
     DO_TEST("boot-order");
-    DO_TEST("bootloader");
 
     DO_TEST("reboot-timeout-enabled");
     DO_TEST("reboot-timeout-disabled");
@@ -259,7 +258,6 @@ mymain(void)
     DO_TEST("graphics-spice-qxl-vga");
     DO_TEST("input-usbmouse");
     DO_TEST("input-usbtablet");
-    DO_TEST("input-xen");
     DO_TEST("misc-acpi");
     DO_TEST("misc-disable-s3");
     DO_TEST("misc-disable-suspends");