mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
qemuValidateDomainDefPSeriesFeature: Simplify feature validation
Unify validation of VIR_DOMAIN_FEATURE_HTM, VIR_DOMAIN_FEATURE_NESTED_HV, VIR_DOMAIN_FEATURE_CCF_ASSIST and remove temporary string. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f13a45d8a9
commit
723a3e74ab
@ -39,8 +39,6 @@ static int
|
||||
qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
|
||||
int feature)
|
||||
{
|
||||
const char *str;
|
||||
|
||||
if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT)
|
||||
return 0;
|
||||
|
||||
@ -59,8 +57,7 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
|
||||
break;
|
||||
|
||||
if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE) {
|
||||
str = virDomainHPTResizingTypeToString(def->hpt_resizing);
|
||||
if (!str) {
|
||||
if (!virDomainHPTResizingTypeToString(def->hpt_resizing)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Invalid setting for HPT resizing"));
|
||||
return -1;
|
||||
@ -69,33 +66,15 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_HTM:
|
||||
str = virTristateSwitchTypeToString(def->features[feature]);
|
||||
if (!str) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Invalid setting for HTM state"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_NESTED_HV:
|
||||
str = virTristateSwitchTypeToString(def->features[feature]);
|
||||
if (!str) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Invalid setting for nested HV state"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
|
||||
str = virTristateSwitchTypeToString(def->features[feature]);
|
||||
if (!str) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Invalid setting for ccf-assist state"));
|
||||
if (!virTristateSwitchTypeToString(def->features[feature])) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Invalid setting for pseries feature '%1$s'"),
|
||||
virDomainFeatureTypeToString(feature));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_CFPC:
|
||||
|
Loading…
Reference in New Issue
Block a user