[libvirt PATCH 02/10] virDomainDeviceBootParseXML: Use virXMLProp*
Tim Wiederhake
twiederh at redhat.com
Wed Apr 21 13:33:24 UTC 2021
Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
src/conf/domain_conf.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5c13d9946c..9113993bce 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6465,22 +6465,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) {
--
2.26.3
More information about the libvir-list
mailing list