mirror of https://gitee.com/openkylin/libvirt.git
conf: Integrate all features ABI checks in the switch
There are a few stray checks which still live outside of the switch in virDomainDefFeaturesCheckABIStability() for no good reason. Move them inside the switch, and update the error messages to be consistent while at it. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
5307206474
commit
f3b4c98748
|
@ -21328,7 +21328,6 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
switch ((virDomainFeature) i) {
|
||||
case VIR_DOMAIN_FEATURE_ACPI:
|
||||
case VIR_DOMAIN_FEATURE_APIC:
|
||||
case VIR_DOMAIN_FEATURE_PAE:
|
||||
case VIR_DOMAIN_FEATURE_HAP:
|
||||
case VIR_DOMAIN_FEATURE_VIRIDIAN:
|
||||
|
@ -21338,10 +21337,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
|||
case VIR_DOMAIN_FEATURE_PVSPINLOCK:
|
||||
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,
|
||||
|
@ -21368,30 +21364,71 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
|||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_GIC:
|
||||
if (src->features[i] != dst->features[i] ||
|
||||
src->gic_version != dst->gic_version) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of feature '%s' differs: "
|
||||
"source: '%s,%s=%s', destination: '%s,%s=%s'"),
|
||||
featureName,
|
||||
virTristateSwitchTypeToString(src->features[i]),
|
||||
"version", virGICVersionTypeToString(src->gic_version),
|
||||
virTristateSwitchTypeToString(dst->features[i]),
|
||||
"version", virGICVersionTypeToString(dst->gic_version));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_HPT:
|
||||
if (src->features[i] != dst->features[i] ||
|
||||
src->hpt_resizing != dst->hpt_resizing) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of feature '%s' differs: "
|
||||
"source: '%s,%s=%s', destination: '%s,%s=%s'"),
|
||||
featureName,
|
||||
virTristateSwitchTypeToString(src->features[i]),
|
||||
"resizing", virDomainHPTResizingTypeToString(src->hpt_resizing),
|
||||
virTristateSwitchTypeToString(dst->features[i]),
|
||||
"resizing", virDomainHPTResizingTypeToString(dst->hpt_resizing));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_APIC:
|
||||
if (src->features[i] != dst->features[i] ||
|
||||
src->apic_eoi != dst->apic_eoi) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of feature '%s' differs: "
|
||||
"source: '%s,%s=%s', destination: '%s,%s=%s'"),
|
||||
featureName,
|
||||
virTristateSwitchTypeToString(src->features[i]),
|
||||
"eoi", virTristateSwitchTypeToString(src->apic_eoi),
|
||||
virTristateSwitchTypeToString(dst->features[i]),
|
||||
"eoi", virTristateSwitchTypeToString(dst->apic_eoi));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_IOAPIC:
|
||||
if (src->features[i] != dst->features[i] ||
|
||||
src->ioapic != dst->ioapic) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of feature '%s' differs: "
|
||||
"source: '%s,%s=%s', destination: '%s,%s=%s'"),
|
||||
featureName,
|
||||
virTristateSwitchTypeToString(src->features[i]),
|
||||
"driver", virDomainIOAPICTypeToString(src->ioapic),
|
||||
virTristateSwitchTypeToString(dst->features[i]),
|
||||
"driver", virDomainIOAPICTypeToString(dst->ioapic));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_LAST:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* APIC EOI */
|
||||
if (src->apic_eoi != dst->apic_eoi) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of APIC EOI differs: "
|
||||
"source: '%s', destination: '%s'"),
|
||||
virTristateSwitchTypeToString(src->apic_eoi),
|
||||
virTristateSwitchTypeToString(dst->apic_eoi));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* GIC version */
|
||||
if (src->gic_version != dst->gic_version) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Source GIC version '%s' does not match destination '%s'"),
|
||||
virGICVersionTypeToString(src->gic_version),
|
||||
virGICVersionTypeToString(dst->gic_version));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* hyperv */
|
||||
if (src->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
|
||||
for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
|
||||
|
@ -21470,28 +21507,6 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
|||
}
|
||||
}
|
||||
|
||||
/* ioapic */
|
||||
if (src->ioapic != dst->ioapic) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of ioapic differs: "
|
||||
"source: '%s', destination: '%s'"),
|
||||
virDomainIOAPICTypeToString(src->ioapic),
|
||||
virDomainIOAPICTypeToString(dst->ioapic));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* HPT resizing */
|
||||
if (src->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON) {
|
||||
if (src->hpt_resizing != dst->hpt_resizing) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("HPT resizing configuration differs: "
|
||||
"source: '%s', destination: '%s'"),
|
||||
virDomainHPTResizingTypeToString(src->hpt_resizing),
|
||||
virDomainHPTResizingTypeToString(dst->hpt_resizing));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue