|
|
6ae9ed |
From 3fd272db468c84a28d967b5d94b4d1479296f6b3 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <3fd272db468c84a28d967b5d94b4d1479296f6b3@dist-git>
|
|
|
6ae9ed |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
Date: Tue, 28 Jun 2016 22:15:25 +0200
|
|
|
6ae9ed |
Subject: [PATCH] qemu: Use bootindex whenever possible
|
|
|
6ae9ed |
|
|
|
6ae9ed |
I'm not sure why our code claimed "-boot menu=on" cannot be used in
|
|
|
6ae9ed |
combination with per-device bootindex, but it was proved wrong about
|
|
|
6ae9ed |
four years ago by commit 8c952908. Let's always use bootindex when QEMU
|
|
|
6ae9ed |
supports it.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1323085
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
(cherry picked from commit 0dd67acfa752123a297469ff873f47cefce95435)
|
|
|
6ae9ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/qemu/qemu_command.c | 18 ++++++--------
|
|
|
6ae9ed |
.../qemuxml2argv-boot-menu-enable-bootindex.args | 23 ++++++++++++++++++
|
|
|
6ae9ed |
.../qemuxml2argv-boot-menu-enable-bootindex.xml | 28 ++++++++++++++++++++++
|
|
|
6ae9ed |
tests/qemuxml2argvtest.c | 2 +-
|
|
|
6ae9ed |
4 files changed, 59 insertions(+), 12 deletions(-)
|
|
|
6ae9ed |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-bootindex.args
|
|
|
6ae9ed |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-bootindex.xml
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
6ae9ed |
index 5b2f041..49412c0 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_command.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_command.c
|
|
|
6ae9ed |
@@ -6028,22 +6028,18 @@ qemuBuildBootCommandLine(virCommandPtr cmd,
|
|
|
6ae9ed |
/*
|
|
|
6ae9ed |
* We prefer using explicit bootindex=N parameters for predictable
|
|
|
6ae9ed |
* results even though domain XML doesn't use per device boot elements.
|
|
|
6ae9ed |
- * However, we can't use bootindex if boot menu was requested.
|
|
|
6ae9ed |
*/
|
|
|
6ae9ed |
- if (!def->os.nBootDevs) {
|
|
|
6ae9ed |
- /* def->os.nBootDevs is guaranteed to be > 0 unless per-device boot
|
|
|
6ae9ed |
- * configuration is used
|
|
|
6ae9ed |
- */
|
|
|
6ae9ed |
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) {
|
|
|
6ae9ed |
+ *emitBootindex = true;
|
|
|
6ae9ed |
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) {
|
|
|
6ae9ed |
+ if (def->os.nBootDevs == 0) {
|
|
|
6ae9ed |
+ /* def->os.nBootDevs is guaranteed to be > 0 unless per-device boot
|
|
|
6ae9ed |
+ * configuration is used
|
|
|
6ae9ed |
+ */
|
|
|
6ae9ed |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
6ae9ed |
_("hypervisor lacks deviceboot feature"));
|
|
|
6ae9ed |
goto error;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
- *emitBootindex = true;
|
|
|
6ae9ed |
- } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) &&
|
|
|
6ae9ed |
- (def->os.bootmenu != VIR_TRISTATE_BOOL_YES ||
|
|
|
6ae9ed |
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU))) {
|
|
|
6ae9ed |
- *emitBootindex = true;
|
|
|
6ae9ed |
+ *emitBootindex = false;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
if (!*emitBootindex) {
|
|
|
6ae9ed |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-bootindex.args b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-bootindex.args
|
|
|
6ae9ed |
new file mode 100644
|
|
|
6ae9ed |
index 0000000..6580b82
|
|
|
6ae9ed |
--- /dev/null
|
|
|
6ae9ed |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-bootindex.args
|
|
|
6ae9ed |
@@ -0,0 +1,23 @@
|
|
|
6ae9ed |
+LC_ALL=C \
|
|
|
6ae9ed |
+PATH=/bin \
|
|
|
6ae9ed |
+HOME=/home/test \
|
|
|
6ae9ed |
+USER=test \
|
|
|
6ae9ed |
+LOGNAME=test \
|
|
|
6ae9ed |
+QEMU_AUDIO_DRV=none \
|
|
|
6ae9ed |
+/usr/bin/qemu \
|
|
|
6ae9ed |
+-name QEMUGuest1 \
|
|
|
6ae9ed |
+-S \
|
|
|
6ae9ed |
+-M pc \
|
|
|
6ae9ed |
+-m 214 \
|
|
|
6ae9ed |
+-smp 1 \
|
|
|
6ae9ed |
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
|
|
6ae9ed |
+-nographic \
|
|
|
6ae9ed |
+-nodefaults \
|
|
|
6ae9ed |
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
|
|
|
6ae9ed |
+-no-acpi \
|
|
|
6ae9ed |
+-boot menu=on \
|
|
|
6ae9ed |
+-usb \
|
|
|
6ae9ed |
+-drive file=/dev/cdrom,format=raw,if=none,media=cdrom,id=drive-ide0-1-0,\
|
|
|
6ae9ed |
+readonly=on \
|
|
|
6ae9ed |
+-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1 \
|
|
|
6ae9ed |
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
|
|
|
6ae9ed |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-bootindex.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-bootindex.xml
|
|
|
6ae9ed |
new file mode 100644
|
|
|
6ae9ed |
index 0000000..831933e
|
|
|
6ae9ed |
--- /dev/null
|
|
|
6ae9ed |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-bootindex.xml
|
|
|
6ae9ed |
@@ -0,0 +1,28 @@
|
|
|
6ae9ed |
+<domain type='qemu'>
|
|
|
6ae9ed |
+ <name>QEMUGuest1</name>
|
|
|
6ae9ed |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
6ae9ed |
+ <memory unit='KiB'>219100</memory>
|
|
|
6ae9ed |
+ <currentMemory unit='KiB'>219100</currentMemory>
|
|
|
6ae9ed |
+ <vcpu placement='static'>1</vcpu>
|
|
|
6ae9ed |
+ <os>
|
|
|
6ae9ed |
+ <type arch='i686' machine='pc'>hvm</type>
|
|
|
6ae9ed |
+ <boot dev='cdrom'/>
|
|
|
6ae9ed |
+ <bootmenu enable='yes'/>
|
|
|
6ae9ed |
+ </os>
|
|
|
6ae9ed |
+ <clock offset='utc'/>
|
|
|
6ae9ed |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
6ae9ed |
+ <on_reboot>restart</on_reboot>
|
|
|
6ae9ed |
+ <on_crash>destroy</on_crash>
|
|
|
6ae9ed |
+ <devices>
|
|
|
6ae9ed |
+ <emulator>/usr/bin/qemu</emulator>
|
|
|
6ae9ed |
+ <disk type='block' device='cdrom'>
|
|
|
6ae9ed |
+ <source dev='/dev/cdrom'/>
|
|
|
6ae9ed |
+ <target dev='hdc' bus='ide'/>
|
|
|
6ae9ed |
+ <readonly/>
|
|
|
6ae9ed |
+ <address type='drive' controller='0' bus='1' target='0' unit='0'/>
|
|
|
6ae9ed |
+ </disk>
|
|
|
6ae9ed |
+ <controller type='usb' index='0'/>
|
|
|
6ae9ed |
+ <controller type='ide' index='0'/>
|
|
|
6ae9ed |
+ <memballoon model='virtio'/>
|
|
|
6ae9ed |
+ </devices>
|
|
|
6ae9ed |
+</domain>
|
|
|
6ae9ed |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
6ae9ed |
index a4b8bf4..a73db5e 100644
|
|
|
6ae9ed |
--- a/tests/qemuxml2argvtest.c
|
|
|
6ae9ed |
+++ b/tests/qemuxml2argvtest.c
|
|
|
6ae9ed |
@@ -622,7 +622,7 @@ mymain(void)
|
|
|
6ae9ed |
DO_TEST("boot-multi", QEMU_CAPS_BOOT_MENU);
|
|
|
6ae9ed |
DO_TEST("boot-menu-enable",
|
|
|
6ae9ed |
QEMU_CAPS_BOOT_MENU);
|
|
|
6ae9ed |
- DO_TEST("boot-menu-enable",
|
|
|
6ae9ed |
+ DO_TEST("boot-menu-enable-bootindex",
|
|
|
6ae9ed |
QEMU_CAPS_BOOT_MENU,
|
|
|
6ae9ed |
QEMU_CAPS_BOOTINDEX);
|
|
|
6ae9ed |
DO_TEST("boot-menu-enable-with-timeout",
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.9.0
|
|
|
6ae9ed |
|