Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
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 e99699028a..0480fc610d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14547,18 +14547,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 09b697432d..2d342effb1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1921,8 +1921,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