提交 a975c959 编写于 作者: A Andrea Bolognani

conf: Use switch in virDomainDefFeaturesCheckABIStability()

The compiler can make sure we are handling all features.
Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 f55fcb7e
...@@ -21324,14 +21324,39 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src, ...@@ -21324,14 +21324,39 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
size_t i; size_t i;
for (i = 0; i < VIR_DOMAIN_FEATURE_LAST; i++) { for (i = 0; i < VIR_DOMAIN_FEATURE_LAST; i++) {
if (src->features[i] != dst->features[i]) { const char *featureName = virDomainFeatureTypeToString(i);
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of feature '%s' differs: " switch ((virDomainFeature) i) {
"source: '%s', destination: '%s'"), case VIR_DOMAIN_FEATURE_ACPI:
virDomainFeatureTypeToString(i), case VIR_DOMAIN_FEATURE_APIC:
virTristateSwitchTypeToString(src->features[i]), case VIR_DOMAIN_FEATURE_PAE:
virTristateSwitchTypeToString(dst->features[i])); case VIR_DOMAIN_FEATURE_HAP:
return false; case VIR_DOMAIN_FEATURE_VIRIDIAN:
case VIR_DOMAIN_FEATURE_PRIVNET:
case VIR_DOMAIN_FEATURE_HYPERV:
case VIR_DOMAIN_FEATURE_KVM:
case VIR_DOMAIN_FEATURE_PVSPINLOCK:
case VIR_DOMAIN_FEATURE_CAPABILITIES:
case VIR_DOMAIN_FEATURE_PMU:
case VIR_DOMAIN_FEATURE_VMPORT:
case VIR_DOMAIN_FEATURE_GIC:
case VIR_DOMAIN_FEATURE_SMM:
case VIR_DOMAIN_FEATURE_IOAPIC:
case VIR_DOMAIN_FEATURE_HPT:
case VIR_DOMAIN_FEATURE_VMCOREINFO:
if (src->features[i] != dst->features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of feature '%s' differs: "
"source: '%s', destination: '%s'"),
featureName,
virTristateSwitchTypeToString(src->features[i]),
virTristateSwitchTypeToString(dst->features[i]));
return false;
}
break;
case VIR_DOMAIN_FEATURE_LAST:
break;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册