Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 28 +++++-----------------------
1 file changed, 5 insertions(+), 23 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6c4595fd20..6b9a5f26e6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18999,7 +18999,7 @@ virDomainVcpuParse(virDomainDefPtr def,
for (i = 0; i < n; i++) {
virDomainVcpuDefPtr vcpu;
- int state;
+ virTristateBool state;
unsigned int id;
unsigned int order;
@@ -19021,31 +19021,13 @@ virDomainVcpuParse(virDomainDefPtr def,
vcpu = virDomainDefGetVcpu(def, id);
- if (!(tmp = virXMLPropString(nodes[i], "enabled"))) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("missing vcpu enabled state"));
+ if (virXMLPropTristateBool(nodes[i], "enabled", true, &state)
< 0)
return -1;
- }
-
- if ((state = virTristateBoolTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid vcpu 'enabled' value
'%s'"), tmp);
- return -1;
- }
- VIR_FREE(tmp);
-
vcpu->online = state == VIR_TRISTATE_BOOL_YES;
- if ((tmp = virXMLPropString(nodes[i], "hotpluggable"))) {
- int hotpluggable;
- if ((hotpluggable = virTristateBoolTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid vcpu 'hotpluggable' value
'%s'"), tmp);
- return -1;
- }
- vcpu->hotpluggable = hotpluggable;
- VIR_FREE(tmp);
- }
+ if (virXMLPropTristateBool(nodes[i], "hotpluggable", false,
+ &vcpu->hotpluggable) < 0)
+ return -1;
if ((tmp = virXMLPropString(nodes[i], "order"))) {
if (virStrToLong_uip(tmp, NULL, 10, &order) < 0) {
--
2.26.2