diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5f6ad5d0b907846cd2bf31176127bd38de7d26dd..9b8802dfba6018d9c306b7b1891b934df516f8c0 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 033f2f65026cfb57a73d1ce7631470ab033bbd2d..9a89dd80fb2278d266ca9bef1eb3e76531a2a71f 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 955702001e49f47a7e7f6f4704a18bdd06105c6a..6e4d602fb4b8b9d9de59c105ca533bb59a01d373 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 0000000000000000000000000000000000000000..6c1f2d795fce672adb1a37098e5c8fdf85f33711
--- /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 0000000000000000000000000000000000000000..5565a5e0fe4dbe46d1bf09b93d76e09a1b56bffd
--- /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 b289d0e8436c941ac3668bfa9400b3ff2f73905a..6255b51ab9ee3a2411fea042b5499737ed7a0c0f 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 0000000000000000000000000000000000000000..62f562d16231b70779a4014ac567866081846e3d
--- /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 594132324492335076cf2d678683b7aae04959ac..79cf59fc2be4827eb40af0213acc362ab920329c 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");