Signed-off-by: Laszlo Ersek <lersek@xxxxxxxxxx> --- src/conf/domain_conf.c | 21 +++++++++++++++++++++ docs/formatdomain.html.in | 9 +++++++++ docs/schemas/domaincommon.rng | 10 ++++++++++ 3 files changed, 40 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f0f165f..cb4c845 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10721,6 +10721,20 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, VIR_FREE(tmp); } + tmp = virXPathString("string(./os/boot-strict[1]/@enable)", ctxt); + if (tmp) { + def->os.bootStrict = virDomainBootStrictTypeFromString(tmp); + if (def->os.bootStrict <= 0) { + /* In order not to break misconfigured machines, this should not + * emit an error, but rather set bootStrict to enabled (the default + * libvirt behavior). */ + VIR_WARN("requesting strict boot due to unknown option '%s'", + tmp); + def->os.bootStrict = VIR_DOMAIN_BOOT_STRICT_ENABLED; + } + VIR_FREE(tmp); + } + tmp = virXPathString("string(./os/bios[1]/@useserial)", ctxt); if (tmp) { if (STREQ(tmp, "yes")) { @@ -17103,6 +17117,13 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAsprintf(buf, " <bootmenu enable='%s'/>\n", enabled); } + if (def->os.bootStrict != VIR_DOMAIN_BOOT_STRICT_DEFAULT) { + const char *enabled = (def->os.bootStrict == + VIR_DOMAIN_BOOT_STRICT_ENABLED ? "yes" + : "no"); + virBufferAsprintf(buf, " <boot-strict enable='%s'/>\n", enabled); + } + if (def->os.bios.useserial || def->os.bios.rt_set) { virBufferAddLit(buf, " <bios"); if (def->os.bios.useserial) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index ff50214..bf21c46 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -106,6 +106,7 @@ <boot dev='hd'/> <boot dev='cdrom'/> <bootmenu enable='yes'/> + <boot-strict enable='yes'/> <smbios mode='sysinfo'/> <bios useserial='yes' rebootTimeout='0'/> </os> @@ -158,6 +159,14 @@ If not specified, the hypervisor default is used. <span class="since"> Since 0.8.3</span> </dd> + <dt><code>boot-strict</code></dt> + <dd>Whether or not to enable strict boot on guest startup. Strict boot + prevents booting from devices that have no boot order specification, + dependent on hypervisor support. The <code>enable</code> attribute can be + either "yes" or "no". If not specified, strict boot is enabled. OVMF + users should explicitly set <code>enable</code> to "no". + <span class="since">Since 1.2.2</span> + </dd> <dt><code>smbios</code></dt> <dd>How to populate SMBIOS information visible in the guest. The <code>mode</code> attribute must be specified, and is either diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 7f55f24..482f719 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -261,6 +261,16 @@ </element> </optional> <optional> + <element name="boot-strict"> + <attribute name="enable"> + <choice> + <value>yes</value> + <value>no</value> + </choice> + </attribute> + </element> + </optional> + <optional> <ref name="smbios"/> </optional> <optional> -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list