From: Michal Privoznik Date: Wed, 11 Feb 2026 09:16:28 +0000 (+0100) Subject: conf: Parse hyperv features even for host-model X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=380fb8939009a420f598175e63994a5bf197fd56;p=thirdparty%2Flibvirt.git conf: Parse hyperv features even for host-model As it turns out, some users of the hyperv "host-model" mode might want to override the hypervisor defaults. For instance disable a feature that's on by default, or vice versa. Currently, this is not possible because as soon as our XML parser sees the "host-model" mode it exits early and skips parsing of individual features (for "custom" mode). Well, do not return early and parse the rest. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index d1352a8fb1..de0de51fe5 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2197,6 +2197,9 @@ are: enlightenments are supported by hypervisor and expands them on domain startup into the live XML. In a sense, this is similar to ``host-model`` CPU mode (See `CPU model and topology`_). :since:`Since 11.9.0` + It is also possible to set features, like in ``custom`` mode. These are + then left untouched and no expansion is done for them. :since:`Since + 12.1.0` The ``mode`` attribute can be omitted and will default to ``custom``. diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ffdd455a0d..bd27575d30 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17262,8 +17262,7 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def, def->features[VIR_DOMAIN_FEATURE_HYPERV] = mode; - if (mode == VIR_DOMAIN_HYPERV_MODE_PASSTHROUGH || - mode == VIR_DOMAIN_HYPERV_MODE_HOST_MODEL) + if (mode == VIR_DOMAIN_HYPERV_MODE_PASSTHROUGH) return 0; node = xmlFirstElementChild(node); diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng index bf37c5332c..8fe1346b05 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -8085,13 +8085,13 @@ passthrough - - host-model - - custom + + custom + host-model + diff --git a/tests/qemuxmlconfdata/hyperv-host-model.x86_64-latest.xml b/tests/qemuxmlconfdata/hyperv-host-model.x86_64-latest.xml index 453a43b3c9..9535cee02a 100644 --- a/tests/qemuxmlconfdata/hyperv-host-model.x86_64-latest.xml +++ b/tests/qemuxmlconfdata/hyperv-host-model.x86_64-latest.xml @@ -10,7 +10,11 @@ - + + + + + qemu64 diff --git a/tests/qemuxmlconfdata/hyperv-host-model.xml b/tests/qemuxmlconfdata/hyperv-host-model.xml index fae00d86dd..473a41892d 100644 --- a/tests/qemuxmlconfdata/hyperv-host-model.xml +++ b/tests/qemuxmlconfdata/hyperv-host-model.xml @@ -10,7 +10,11 @@ - + + + + + destroy