On 12/14/21 17:53, Tim Wiederhake wrote:
Previous patch neglected the possibility of different modes for
hyperv
(e.g. "custom" and "passthrough").
Fixes: 6e83fafe331dd0b4fb19aa384c3dd36b3af62933
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9a21ac10ce..2d8851fa11 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -21734,6 +21734,15 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
}
/* hyperv */
+ if (src->features[VIR_DOMAIN_FEATURE_HYPERV] !=
dst->features[VIR_DOMAIN_FEATURE_HYPERV]) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("State of HyperV enlightenment mode differs: "
+ "source: '%s', destination: '%s'"),
+
virDomainHyperVModeTypeToString(src->features[VIR_DOMAIN_FEATURE_HYPERV]),
+
virDomainHyperVModeTypeToString(dst->features[VIR_DOMAIN_FEATURE_HYPERV]));
+ return false;
+ }
+
if (src->features[VIR_DOMAIN_FEATURE_HYPERV] != VIR_DOMAIN_HYPERV_MODE_NONE) {
for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
switch ((virDomainHyperv) i) {
I worry that this is effectively a dead code. In this function, just a
couple of lines earlier we have:
for (i = 0; i < VIR_DOMAIN_FEATURE_LAST; i++) {
const char *featureName = virDomainFeatureTypeToString(i);
switch ((virDomainFeature) i) {
...
case VIR_DOMAIN_FEATURE_HYPERV:
...
if (src->features[i] != dst->features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of feature '%s' differs: "
"source: '%s', destination:
'%s'"),
featureName, ....
return false;
}
break;
So if VIR_DOMAIN_FEATURE_HYPERV is not the same on src and dst we will
never get to this code you're adding.
Michal