[libvirt] [PATCH 0/3] Add support for boot menu timeout

This is basically just for qemu's '-boot splash-time' parameter. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1021703 Martin Kletzander (3): docs, conf: add support for bootmenu timeout qemu: add capability probing for splash-timeout qemu: add support for splash-timeout docs/formatdomain.html.in | 7 +++++- docs/schemas/domaincommon.rng | 5 ++++ src/conf/domain_conf.c | 21 ++++++++++++++-- src/conf/domain_conf.h | 2 ++ src/qemu/qemu_capabilities.c | 5 ++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 15 +++++++++++ tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 + tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 + tests/qemuhelptest.c | 12 ++++++--- ...qemuxml2argv-boot-menu-disable-with-timeout.xml | 29 ++++++++++++++++++++++ ...2argv-boot-menu-enable-with-timeout-invalid.xml | 29 ++++++++++++++++++++++ ...qemuxml2argv-boot-menu-enable-with-timeout.args | 15 +++++++++++ .../qemuxml2argv-boot-menu-enable-with-timeout.xml | 29 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 5 ++++ ...muxml2xmlout-boot-menu-disable-with-timeout.xml | 29 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 2 ++ 18 files changed, 202 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-with-timeout.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout-invalid.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml -- 2.0.4

Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- docs/formatdomain.html.in | 7 +++++- docs/schemas/domaincommon.rng | 5 ++++ src/conf/domain_conf.c | 21 ++++++++++++++-- src/conf/domain_conf.h | 2 ++ ...qemuxml2argv-boot-menu-disable-with-timeout.xml | 29 ++++++++++++++++++++++ ...2argv-boot-menu-enable-with-timeout-invalid.xml | 29 ++++++++++++++++++++++ .../qemuxml2argv-boot-menu-enable-with-timeout.xml | 29 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + ...muxml2xmlout-boot-menu-disable-with-timeout.xml | 29 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 2 ++ 10 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-with-timeout.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout-invalid.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index ed17389..dedc4d1 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -105,7 +105,7 @@ <loader>/usr/lib/xen/boot/hvmloader</loader> <boot dev='hd'/> <boot dev='cdrom'/> - <bootmenu enable='yes'/> + <bootmenu enable='yes' timeout='3000'/> <smbios mode='sysinfo'/> <bios useserial='yes' rebootTimeout='0'/> </os> @@ -158,6 +158,11 @@ startup. The <code>enable</code> attribute can be either "yes" or "no". If not specified, the hypervisor default is used. <span class="since"> Since 0.8.3</span> + Additional attribute <code>timeout</code> takes the number of milliseconds + the boot menu should wait until it times out. Allowed values are numbers + in range [0, 65535] inclusive and it is valid if and only if the previous + <code>enable</code> is set to "yes". + <span class="since"> Since 1.2.8</span> </dd> <dt><code>smbios</code></dt> <dd>How to populate SMBIOS information visible in the guest. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 033f2f6..9a89dd8 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -259,6 +259,11 @@ <value>no</value> </choice> </attribute> + <optional> + <attribute name="timeout"> + <ref name="unsignedShort"/> + </attribute> + </optional> </element> </optional> <optional> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9557020..6e4d602 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11188,6 +11188,19 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, VIR_FREE(tmp); } + tmp = virXPathString("string(./os/bootmenu[1]/@timeout)", ctxt); + if (tmp && def->os.bootmenu == VIR_TRISTATE_BOOL_YES) { + if (virStrToLong_uip(tmp, NULL, 0, &def->os.bm_timeout) < 0 || + def->os.bm_timeout > 65535) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("invalid value for boot menu timeout, " + "must be in range [0,65535]")); + goto cleanup; + } + def->os.bm_timeout_set = true; + } + VIR_FREE(tmp); + tmp = virXPathString("string(./os/bios[1]/@useserial)", ctxt); if (tmp) { if (STREQ(tmp, "yes")) { @@ -17960,9 +17973,13 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAsprintf(buf, "<boot dev='%s'/>\n", boottype); } - if (def->os.bootmenu) - virBufferAsprintf(buf, "<bootmenu enable='%s'/>\n", + if (def->os.bootmenu) { + virBufferAsprintf(buf, "<bootmenu enable='%s'", virTristateBoolTypeToString(def->os.bootmenu)); + if (def->os.bm_timeout_set) + virBufferAsprintf(buf, " timeout='%u'", def->os.bm_timeout); + virBufferAddLit(buf, "/>\n"); + } if (def->os.bios.useserial || def->os.bios.rt_set) { virBufferAddLit(buf, "<bios"); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f2df4eb..36ccf10 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1630,6 +1630,8 @@ struct _virDomainOSDef { size_t nBootDevs; int bootDevs[VIR_DOMAIN_BOOT_LAST]; int bootmenu; /* enum virTristateBool */ + unsigned int bm_timeout; + bool bm_timeout_set; char *init; char **initargv; char *kernel; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-with-timeout.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-with-timeout.xml new file mode 100644 index 0000000..0f9bd0a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-with-timeout.xml @@ -0,0 +1,29 @@ +<domain type='qemu'> + <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> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='cdrom'/> + <bootmenu enable='no' timeout='3000'/> + </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='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'/> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout-invalid.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout-invalid.xml new file mode 100644 index 0000000..6c1f2d7 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout-invalid.xml @@ -0,0 +1,29 @@ +<domain type='qemu'> + <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> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='cdrom'/> + <bootmenu enable='yes' timeout='65536'/> + </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='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'/> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.xml new file mode 100644 index 0000000..5565a5e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.xml @@ -0,0 +1,29 @@ +<domain type='qemu'> + <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> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='cdrom'/> + <bootmenu enable='yes' timeout='3000'/> + </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='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'/> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 65dc9c7..cfeec4f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -607,6 +607,7 @@ mymain(void) DO_TEST("boot-menu-enable", QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_BOOTINDEX); + DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", NONE); DO_TEST("boot-menu-disable", QEMU_CAPS_BOOT_MENU); DO_TEST("boot-menu-disable-drive", QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml new file mode 100644 index 0000000..62f562d --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml @@ -0,0 +1,29 @@ +<domain type='qemu'> + <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> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='cdrom'/> + <bootmenu enable='no'/> + </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='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'/> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5941323..79cf59f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -171,7 +171,9 @@ mymain(void) DO_TEST("boot-network"); DO_TEST("boot-floppy"); DO_TEST("boot-multi"); + DO_TEST("boot-menu-enable-with-timeout"); DO_TEST("boot-menu-disable"); + DO_TEST_DIFFERENT("boot-menu-disable-with-timeout"); DO_TEST("boot-order"); DO_TEST("bootloader"); -- 2.0.4

On 08/22/2014 09:09 AM, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- docs/formatdomain.html.in | 7 +++++- docs/schemas/domaincommon.rng | 5 ++++ src/conf/domain_conf.c | 21 ++++++++++++++-- src/conf/domain_conf.h | 2 ++ ...qemuxml2argv-boot-menu-disable-with-timeout.xml | 29 ++++++++++++++++++++++ ...2argv-boot-menu-enable-with-timeout-invalid.xml | 29 ++++++++++++++++++++++ .../qemuxml2argv-boot-menu-enable-with-timeout.xml | 29 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + ...muxml2xmlout-boot-menu-disable-with-timeout.xml | 29 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 2 ++ 10 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-with-timeout.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout-invalid.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml
@@ -158,6 +158,11 @@ startup. The <code>enable</code> attribute can be either "yes" or "no". If not specified, the hypervisor default is used. <span class="since"> Since 0.8.3</span> + Additional attribute <code>timeout</code> takes the number of milliseconds + the boot menu should wait until it times out. Allowed values are numbers + in range [0, 65535] inclusive and it is valid if and only if the previous + <code>enable</code> is set to "yes".
You know, it is possible to have RelaxNG enforce this restriction:
+ <span class="since"> Since 1.2.8</span> </dd> <dt><code>smbios</code></dt> <dd>How to populate SMBIOS information visible in the guest. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 033f2f6..9a89dd8 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -259,6 +259,11 @@ <element name="bootmenu"> <attribute name="enable"> <choice> <value>yes</value> <value>no</value> </choice> </attribute> + <optional> + <attribute name="timeout"> + <ref name="unsignedShort"/> + </attribute> + </optional>
would instead be: <element name="bootmenu"> <choice> <attribute name="enable"> <value>no</value> </attribute> <group> <attribute name="enable"> <value>yes</value> </attribute> <optional> <attribute name="timeout"> <ref name="unsignedShort"/> </attribute> </optional> </group> </choice> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Mon, Aug 25, 2014 at 09:48:17AM -0600, Eric Blake wrote:
On 08/22/2014 09:09 AM, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- docs/formatdomain.html.in | 7 +++++- docs/schemas/domaincommon.rng | 5 ++++ src/conf/domain_conf.c | 21 ++++++++++++++-- src/conf/domain_conf.h | 2 ++ ...qemuxml2argv-boot-menu-disable-with-timeout.xml | 29 ++++++++++++++++++++++ ...2argv-boot-menu-enable-with-timeout-invalid.xml | 29 ++++++++++++++++++++++ .../qemuxml2argv-boot-menu-enable-with-timeout.xml | 29 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + ...muxml2xmlout-boot-menu-disable-with-timeout.xml | 29 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 2 ++ 10 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-with-timeout.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout-invalid.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml
@@ -158,6 +158,11 @@ startup. The <code>enable</code> attribute can be either "yes" or "no". If not specified, the hypervisor default is used. <span class="since"> Since 0.8.3</span> + Additional attribute <code>timeout</code> takes the number of milliseconds + the boot menu should wait until it times out. Allowed values are numbers + in range [0, 65535] inclusive and it is valid if and only if the previous + <code>enable</code> is set to "yes".
You know, it is possible to have RelaxNG enforce this restriction:
Yes, but I wanted it to be just ignored if enable="no". There are, of course, other options, like keeping it there, but not using it or leaving what it does on qemu. I gues I could add "otherwise it gets ignored" at the end of the sentence. Should I do that, change the behaviour or add the checks (and adjust tests of course)? It needs a follow-up, though since I already pushed it thanks to Jan's ACK. Martin

On 08/25/2014 10:09 AM, Martin Kletzander wrote:
+ Additional attribute <code>timeout</code> takes the number of milliseconds + the boot menu should wait until it times out. Allowed values are numbers + in range [0, 65535] inclusive and it is valid if and only if the previous + <code>enable</code> is set to "yes".
You know, it is possible to have RelaxNG enforce this restriction:
Yes, but I wanted it to be just ignored if enable="no". There are, of course, other options, like keeping it there, but not using it or leaving what it does on qemu. I gues I could add "otherwise it gets ignored" at the end of the sentence. Should I do that, change the behaviour or add the checks (and adjust tests of course)? It needs a follow-up, though since I already pushed it thanks to Jan's ACK.
Maybe the simplest thing is a followup which changes: s/it is valid if and only if the previous enable is set to yes/it is ignored unless enable is set to yes/ -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/qemu/qemu_capabilities.c | 5 +++++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 + tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 + tests/qemuhelptest.c | 12 ++++++++---- 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b758b5a..410086b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -266,6 +266,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "memory-backend-file", "usb-audio", "rtc-reset-reinjection", + + "splash-timeout", /* 175 */ ); @@ -1132,6 +1134,8 @@ virQEMUCapsComputeCmdFlags(const char *help, virQEMUCapsSet(qemuCaps, QEMU_CAPS_BOOT_MENU); if (strstr(help, ",reboot-timeout=rb_time")) virQEMUCapsSet(qemuCaps, QEMU_CAPS_REBOOT_TIMEOUT); + if (strstr(help, ",splash-time=sp_time")) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SPLASH_TIMEOUT); if ((fsdev = strstr(help, "-fsdev"))) { virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV); if (strstr(fsdev, "readonly")) @@ -2431,6 +2435,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = { { "realtime", "mlock", QEMU_CAPS_MLOCK }, { "boot-opts", "strict", QEMU_CAPS_BOOT_STRICT }, { "boot-opts", "reboot-timeout", QEMU_CAPS_REBOOT_TIMEOUT }, + { "boot-opts", "splash-time", QEMU_CAPS_SPLASH_TIMEOUT }, { "spice", "disable-agent-file-xfer", QEMU_CAPS_SPICE_FILE_XFER_DISABLE }, { "msg", "timestamp", QEMU_CAPS_MSG_TIMESTAMP }, { "numa", NULL, QEMU_CAPS_NUMA }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index cbd3646..48a4eaa 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -214,6 +214,7 @@ typedef enum { QEMU_CAPS_OBJECT_MEMORY_FILE = 172, /* -object memory-backend-file */ QEMU_CAPS_OBJECT_USB_AUDIO = 173, /* usb-audio device support */ QEMU_CAPS_RTC_RESET_REINJECTION = 174, /* rtc-reset-reinjection monitor command */ + QEMU_CAPS_SPLASH_TIMEOUT = 175, /* -boot splash-time */ QEMU_CAPS_LAST, /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps index 5fa30aa..c220b46 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps @@ -138,4 +138,5 @@ <flag name='usb-kbd'/> <flag name='host-pci-multidomain'/> <flag name='usb-audio'/> + <flag name='splash-timeout'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps index f364bbf..e10f030 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps @@ -145,4 +145,5 @@ <flag name='host-pci-multidomain'/> <flag name='msg-timestamp'/> <flag name='usb-audio'/> + <flag name='splash-timeout'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps index 10ce1b5..44f7b0c 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps @@ -144,4 +144,5 @@ <flag name='msg-timestamp'/> <flag name='numa'/> <flag name='usb-audio'/> + <flag name='splash-timeout'/> </qemuCaps> diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index 366e36d..975edf3 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -745,7 +745,8 @@ mymain(void) QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX, QEMU_CAPS_DEVICE_USB_KBD, - QEMU_CAPS_DEVICE_USB_STORAGE); + QEMU_CAPS_DEVICE_USB_STORAGE, + QEMU_CAPS_SPLASH_TIMEOUT); DO_TEST("qemu-1.1.0", 1001000, 0, 0, QEMU_CAPS_VNC_COLON, QEMU_CAPS_NO_REBOOT, @@ -843,7 +844,8 @@ mymain(void) QEMU_CAPS_VNC_SHARE_POLICY, QEMU_CAPS_DEVICE_USB_KBD, QEMU_CAPS_DEVICE_USB_STORAGE, - QEMU_CAPS_OBJECT_USB_AUDIO); + QEMU_CAPS_OBJECT_USB_AUDIO, + QEMU_CAPS_SPLASH_TIMEOUT); DO_TEST("qemu-1.2.0", 1002000, 0, 0, QEMU_CAPS_VNC_COLON, QEMU_CAPS_NO_REBOOT, @@ -953,7 +955,8 @@ mymain(void) QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_DEVICE_USB_KBD, QEMU_CAPS_USB_STORAGE_REMOVABLE, - QEMU_CAPS_OBJECT_USB_AUDIO); + QEMU_CAPS_OBJECT_USB_AUDIO, + QEMU_CAPS_SPLASH_TIMEOUT); DO_TEST("qemu-kvm-1.2.0", 1002000, 1, 0, QEMU_CAPS_VNC_COLON, QEMU_CAPS_NO_REBOOT, @@ -1068,7 +1071,8 @@ mymain(void) QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_DEVICE_USB_KBD, QEMU_CAPS_USB_STORAGE_REMOVABLE, - QEMU_CAPS_OBJECT_USB_AUDIO); + QEMU_CAPS_OBJECT_USB_AUDIO, + QEMU_CAPS_SPLASH_TIMEOUT); return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } -- 2.0.4

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1021703 Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/qemu/qemu_command.c | 15 +++++++++++++++ .../qemuxml2argv-boot-menu-enable-with-timeout.args | 15 +++++++++++++++ tests/qemuxml2argvtest.c | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0d7b12d..bb1c423 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7927,6 +7927,21 @@ qemuBuildCommandLine(virConnectPtr conn, def->os.bios.rt_delay); } + 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, ','); + + virBufferAsprintf(&boot_buf, "splash-time=%d", def->os.bm_timeout); + } + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_STRICT)) { if (boot_nparams++) virBufferAddChar(&boot_buf, ','); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.args b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.args new file mode 100644 index 0000000..6141259 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.args @@ -0,0 +1,15 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi \ +-boot order=d,menu=on,splash-time=3000 \ +-usb \ +-drive file=/dev/cdrom,if=none,media=cdrom,id=drive-ide0-1-0 \ +-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index cfeec4f..97ffb3c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -607,6 +607,10 @@ mymain(void) DO_TEST("boot-menu-enable", QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_BOOTINDEX); + DO_TEST("boot-menu-enable-with-timeout", + QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, + QEMU_CAPS_DRIVE, QEMU_CAPS_SPLASH_TIMEOUT); + DO_TEST_FAILURE("boot-menu-enable-with-timeout", QEMU_CAPS_BOOT_MENU); DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", NONE); DO_TEST("boot-menu-disable", QEMU_CAPS_BOOT_MENU); DO_TEST("boot-menu-disable-drive", -- 2.0.4

On 08/22/2014 05:10 PM, Martin Kletzander wrote:
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1021703
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/qemu/qemu_command.c | 15 +++++++++++++++ .../qemuxml2argv-boot-menu-enable-with-timeout.args | 15 +++++++++++++++ tests/qemuxml2argvtest.c | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable-with-timeout.args
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0d7b12d..bb1c423 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7927,6 +7927,21 @@ qemuBuildCommandLine(virConnectPtr conn, def->os.bios.rt_delay); }
+ 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, ','); + + virBufferAsprintf(&boot_buf, "splash-time=%d", def->os.bm_timeout);
This should be %u for usigned int. Also, it would be nice to get rid of 'boot_nparams', but that's out of scope of this patch. ACK series Jan
participants (3)
-
Eric Blake
-
Ján Tomko
-
Martin Kletzander