conf: Use virTristateXXX in virDomainMemballoonDef

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-04-07 13:48:36 +02:00 committed by Peter Krempa
parent 108ec08b1b
commit f940ec5f36
2 changed files with 18 additions and 12 deletions

View File

@ -14569,18 +14569,24 @@ virDomainMemballoonDefParseXML(virDomainXMLOption *xmlopt,
goto error;
}
if ((deflate = virXMLPropString(node, "autodeflate")) &&
(def->autodeflate = virTristateSwitchTypeFromString(deflate)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("invalid autodeflate attribute value '%s'"), deflate);
goto error;
if ((deflate = virXMLPropString(node, "autodeflate"))) {
int value;
if ((value = virTristateSwitchTypeFromString(deflate)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("invalid autodeflate attribute value '%s'"), deflate);
goto error;
}
def->autodeflate = value;
}
if ((freepage_reporting = virXMLPropString(node, "freePageReporting")) &&
(def->free_page_reporting = virTristateSwitchTypeFromString(freepage_reporting)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("invalid freePageReporting attribute value '%s'"), freepage_reporting);
goto error;
if ((freepage_reporting = virXMLPropString(node, "freePageReporting"))) {
int value;
if ((value = virTristateSwitchTypeFromString(freepage_reporting)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("invalid freePageReporting attribute value '%s'"), freepage_reporting);
goto error;
}
def->free_page_reporting = value;
}
ctxt->node = node;

View File

@ -1915,8 +1915,8 @@ struct _virDomainMemballoonDef {
int model;
virDomainDeviceInfo info;
int period; /* seconds between collections */
int autodeflate; /* enum virTristateSwitch */
int free_page_reporting; /* enum virTristateSwitch */
virTristateSwitch autodeflate;
virTristateSwitch free_page_reporting;
virDomainVirtioOptions *virtio;
};