]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainDeviceBootParseXML: Use virXMLProp*
authorTim Wiederhake <twiederh@redhat.com>
Wed, 21 Apr 2021 13:33:24 +0000 (15:33 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 21 Apr 2021 15:11:04 +0000 (17:11 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_conf.c

index 87384c52b5c698f0d43852212b5c47aa80c42728..878f4896655f7f2d7be457a308464654789ed801 100644 (file)
@@ -6480,22 +6480,12 @@ static int
 virDomainDeviceBootParseXML(xmlNodePtr node,
                             virDomainDeviceInfo *info)
 {
-    g_autofree char *order = NULL;
     g_autofree char *loadparm = NULL;
 
-    if (!(order = virXMLPropString(node, "order"))) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("missing boot order attribute"));
-        return -1;
-    }
-
-    if (virStrToLong_uip(order, NULL, 10, &info->bootIndex) < 0 ||
-        info->bootIndex == 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("incorrect boot order '%s', expecting positive integer"),
-                       order);
+    if (virXMLPropUInt(node, "order", 10,
+                       VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
+                       &info->bootIndex) < 0)
         return -1;
-    }
 
     loadparm = virXMLPropString(node, "loadparm");
     if (loadparm) {