Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/domain_conf.c | 26 ++++++++++++++++---------- src/conf/domain_conf.h | 4 ++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2ae3080a8c..313d7fd291 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14557,18 +14557,24 @@ virDomainMemballoonDefParseXML(virDomainXMLOptionPtr 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; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 445f48d8ed..cdf3e2ed8e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1922,8 +1922,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; virDomainVirtioOptionsPtr virtio; }; -- 2.26.2