virDomainFeaturesDefParse: Simplify APIC parsing

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-06-22 14:22:57 +02:00 committed by Michal Privoznik
parent f1a65a8163
commit b683978f1f

View File

@ -17532,7 +17532,6 @@ virDomainFeaturesDefParse(virDomainDef *def,
return -1; return -1;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
g_autofree char *tmp = NULL;
int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name); int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name);
if (val < 0) { if (val < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@ -17541,18 +17540,6 @@ virDomainFeaturesDefParse(virDomainDef *def,
} }
switch ((virDomainFeature) val) { switch ((virDomainFeature) val) {
case VIR_DOMAIN_FEATURE_APIC:
if ((tmp = virXPathString("string(./features/apic/@eoi)", ctxt))) {
int eoi;
if ((eoi = virTristateSwitchTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown value for attribute eoi: '%s'"),
tmp);
return -1;
}
def->apic_eoi = eoi;
}
G_GNUC_FALLTHROUGH;
case VIR_DOMAIN_FEATURE_ACPI: case VIR_DOMAIN_FEATURE_ACPI:
case VIR_DOMAIN_FEATURE_PAE: case VIR_DOMAIN_FEATURE_PAE:
case VIR_DOMAIN_FEATURE_VIRIDIAN: case VIR_DOMAIN_FEATURE_VIRIDIAN:
@ -17560,6 +17547,16 @@ virDomainFeaturesDefParse(virDomainDef *def,
def->features[val] = VIR_TRISTATE_SWITCH_ON; def->features[val] = VIR_TRISTATE_SWITCH_ON;
break; break;
case VIR_DOMAIN_FEATURE_APIC: {
virTristateSwitch eoi;
if (virXMLPropTristateSwitch(nodes[i], "eoi", VIR_XML_PROP_NONE, &eoi) < 0)
return -1;
def->features[val] = VIR_TRISTATE_SWITCH_ON;
def->apic_eoi = eoi;
break;
}
case VIR_DOMAIN_FEATURE_MSRS: { case VIR_DOMAIN_FEATURE_MSRS: {
virDomainMsrsUnknown unknown; virDomainMsrsUnknown unknown;
if (virXMLPropEnum(nodes[i], "unknown", if (virXMLPropEnum(nodes[i], "unknown",