The virDomainDiskSourceNVMeParse() 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 | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bdf0ae06a8..e348748062 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8369,7 +8369,6 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node,
{
g_autoptr(virStorageSourceNVMeDef) nvme = NULL;
g_autofree char *type = NULL;
- g_autofree char *namespc = NULL;
xmlNodePtr address;
nvme = g_new0(virStorageSourceNVMeDef, 1);
@@ -8387,18 +8386,10 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node,
return -1;
}
- if (!(namespc = virXMLPropString(node, "namespace"))) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("missing 'namespace' attribute to disk
source"));
+ if (virXMLPropULongLong(node, "namespace", 10,
+ VIR_XML_PROP_REQUIRED,
+ &nvme->namespc) < 0)
return -1;
- }
-
- if (virStrToLong_ull(namespc, NULL, 10, &nvme->namespc) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("malformed namespace '%s'"),
- namespc);
- return -1;
- }
if (virXMLPropTristateBool(node, "managed", VIR_XML_PROP_NONE,
&nvme->managed) < 0)
--
2.35.1