From 43b8123d398361c1354804e0768f95163c69447f Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Aug 25 2014 12:10:54 +0000 Subject: docs, conf: add support for bootmenu timeout Signed-off-by: Martin Kletzander --- diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 5f6ad5d..9b8802d 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 enable attribute can be either "yes" or "no". If not specified, the hypervisor default is used. Since 0.8.3 + Additional attribute timeout 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 + enable is set to "yes". + Since 1.2.8
smbios
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 @@ no + + + + + 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, "\n", boottype); } - if (def->os.bootmenu) - virBufferAsprintf(buf, "\n", + if (def->os.bootmenu) { + virBufferAsprintf(buf, "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, " + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + +
+ + + + + + + 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 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + +
+ + + + + + + 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 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + +
+ + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b289d0e..6255b51 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 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + +
+ + + + + + + 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");