Currently, this attribute may either have a value of "custom", or be absent
(which defaults to "custom"), for backwards compatibility.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 11 +++++++++--
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_validate.c | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 74d86a346a..0ea00955c5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17453,7 +17453,14 @@ static int
virDomainFeaturesHyperVDefParse(virDomainDef *def,
xmlNodePtr node)
{
- def->features[VIR_DOMAIN_FEATURE_HYPERV] = VIR_TRISTATE_SWITCH_ON;
+ virDomainHyperVMode mode;
+
+ if (virXMLPropEnumDefault(node, "mode", virDomainHyperVModeTypeFromString,
+ VIR_XML_PROP_NONZERO, &mode,
+ VIR_DOMAIN_HYPERV_MODE_CUSTOM) < 0)
+ return -1;
+
+ def->features[VIR_DOMAIN_FEATURE_HYPERV] = mode;
node = xmlFirstElementChild(node);
while (node != NULL) {
@@ -21703,7 +21710,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
}
/* hyperv */
- if (src->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
+ if (src->features[VIR_DOMAIN_FEATURE_HYPERV] != VIR_DOMAIN_HYPERV_MODE_NONE) {
for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
switch ((virDomainHyperv) i) {
case VIR_DOMAIN_HYPERV_RELAXED:
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7a185061d8..0d62a735f6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6788,7 +6788,7 @@ qemuBuildCpuCommandLine(virCommand *cmd,
VIR_TRISTATE_SWITCH_ON ? "on" : "off");
}
- if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
+ if (def->features[VIR_DOMAIN_FEATURE_HYPERV] != VIR_DOMAIN_HYPERV_MODE_NONE) {
for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
switch ((virDomainHyperv) i) {
case VIR_DOMAIN_HYPERV_RELAXED:
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 397eea5ede..9dc8be02d4 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -273,7 +273,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
break;
case VIR_DOMAIN_FEATURE_HYPERV:
- if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
+ if (def->features[i] != VIR_DOMAIN_HYPERV_MODE_NONE &&
!ARCH_IS_X86(def->os.arch) && !qemuDomainIsARMVirt(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Hyperv features are not supported for "
--
2.31.1