1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

qemuValidateDomainDefPSeriesFeature: Simplify machine validation logic

Return early and reformat the error message.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-03-21 16:11:43 +01:00
parent 518d8d1de1
commit f13a45d8a9

View File

@ -41,8 +41,10 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
{
const char *str;
if (def->features[feature] != VIR_TRISTATE_SWITCH_ABSENT &&
!qemuDomainIsPSeries(def)) {
if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT)
return 0;
if (!qemuDomainIsPSeries(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("The '%1$s' feature is not supported for architecture '%2$s' or machine type '%3$s'"),
virDomainFeatureTypeToString(feature),
@ -51,9 +53,6 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
return -1;
}
if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT)
return 0;
switch (feature) {
case VIR_DOMAIN_FEATURE_HPT:
if (def->features[feature] != VIR_TRISTATE_SWITCH_ON)