Remove bootloader option from QEMU

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
This commit is contained in:
Ján Tomko 2015-02-18 16:08:40 +01:00
parent 0c1aa8d7a6
commit 9aa316612a
8 changed files with 123 additions and 197 deletions

View 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 (!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];
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 (def->os.bootmenu) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU)) {
if (boot_nparams++)
virBufferAddChar(&boot_buf, ',');
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.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 (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 (boot_nparams++)
virBufferAddChar(&boot_buf, ',');
if (boot_nparams++)
virBufferAddChar(&boot_buf, ',');
virBufferAsprintf(&boot_buf,
"reboot-timeout=%d",
def->os.bios.rt_delay);
}
virBufferAsprintf(&boot_buf, "splash-time=%u", def->os.bm_timeout);
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 (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_STRICT)) {
if (boot_nparams++)
virBufferAddChar(&boot_buf, ',');
virBufferAddLit(&boot_buf, "strict=on");
if (boot_nparams++)
virBufferAddChar(&boot_buf, ',');
virBufferAsprintf(&boot_buf, "splash-time=%u", def->os.bm_timeout);
}
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 (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 */

View 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)))

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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>

View 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);

View 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");