mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +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:
parent
518d8d1de1
commit
f13a45d8a9
@ -41,8 +41,10 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
|
|||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
if (def->features[feature] != VIR_TRISTATE_SWITCH_ABSENT &&
|
if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT)
|
||||||
!qemuDomainIsPSeries(def)) {
|
return 0;
|
||||||
|
|
||||||
|
if (!qemuDomainIsPSeries(def)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("The '%1$s' feature is not supported for architecture '%2$s' or machine type '%3$s'"),
|
_("The '%1$s' feature is not supported for architecture '%2$s' or machine type '%3$s'"),
|
||||||
virDomainFeatureTypeToString(feature),
|
virDomainFeatureTypeToString(feature),
|
||||||
@ -51,9 +53,6 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch (feature) {
|
switch (feature) {
|
||||||
case VIR_DOMAIN_FEATURE_HPT:
|
case VIR_DOMAIN_FEATURE_HPT:
|
||||||
if (def->features[feature] != VIR_TRISTATE_SWITCH_ON)
|
if (def->features[feature] != VIR_TRISTATE_SWITCH_ON)
|
||||||
|
Loading…
Reference in New Issue
Block a user