The virDomainDiskDefParseSourceXML() function uses old style of
parsing XML (virXMLPropString + str2enum conversion). Use
virXMLPropEnumDefault() which encapsulates those steps.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/domain_conf.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3bbc5f2214..97cf4f20eb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9043,15 +9043,11 @@ virDomainDiskDefParseSourceXML(virDomainXMLOption *xmlopt,
if (virDomainStorageSourceParse(tmp, ctxt, src, flags, xmlopt) < 0)
return NULL;
- if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) {
- g_autofree char *sourceindex = NULL;
-
- if ((sourceindex = virXMLPropString(tmp, "index")) &&
- virStrToLong_uip(sourceindex, NULL, 10, &src->id) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid disk index '%s'"),
sourceindex);
- return NULL;
- }
+ if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
+ virXMLPropUInt(tmp, "index", 10,
+ VIR_XML_PROP_NONE,
+ &src->id) < 0) {
+ return NULL;
}
} else {
/* Reset src->type in case when 'source' was not present */
--
2.35.1