]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainResctrlMonDefParse: Use virXMLProp*
authorTim Wiederhake <twiederh@redhat.com>
Tue, 4 May 2021 14:02:35 +0000 (16:02 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 6 May 2021 11:54:40 +0000 (13:54 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_conf.c

index 5f5d90537347e11dbcec2f39d5a8cec42866a09a..f536630d720ae18eeac41710510783cc9beca996 100644 (file)
@@ -18580,19 +18580,9 @@ virDomainResctrlMonDefParse(virDomainDef *def,
         }
 
         if (tag == VIR_RESCTRL_MONITOR_TYPE_CACHE) {
-            tmp = virXMLPropString(nodes[i], "level");
-            if (!tmp) {
-                virReportError(VIR_ERR_XML_ERROR, "%s",
-                               _("Missing monitor attribute 'level'"));
+            if (virXMLPropUInt(nodes[i], "level", 10, VIR_XML_PROP_REQUIRED,
+                               &level) < 0)
                 goto cleanup;
-            }
-
-            if (virStrToLong_uip(tmp, NULL, 10, &level) < 0) {
-                virReportError(VIR_ERR_XML_ERROR,
-                               _("Invalid monitor attribute 'level' value '%s'"),
-                               tmp);
-                goto cleanup;
-            }
 
             if (level != VIR_DOMAIN_RESCTRL_MONITOR_CACHELEVEL) {
                 virReportError(VIR_ERR_XML_ERROR,
@@ -18600,8 +18590,6 @@ virDomainResctrlMonDefParse(virDomainDef *def,
                                level);
                 goto cleanup;
             }
-
-            VIR_FREE(tmp);
         }
 
         if (virDomainResctrlParseVcpus(def, nodes[i], &domresmon->vcpus) < 0)