Re: [libvirt PATCH 10/10] virStoragePoolDefParseXML: Use virXMLProp*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/11/21 11:01 AM, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
Reviewed-by: Laine Stump <laine@xxxxxxxxxx>

---
  src/conf/storage_conf.c | 15 ++++-----------
  1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 10b46ac368..e481cac75c 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -841,24 +841,17 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
      virStoragePoolOptions *options;
      xmlNodePtr source_node;
      g_autoptr(virStoragePoolDef) def = NULL;
-    g_autofree char *type = NULL;
+    virStoragePoolType type;
      g_autofree char *uuid = NULL;
      g_autofree char *target_path = NULL;
def = g_new0(virStoragePoolDef, 1); - type = virXPathString("string(./@type)", ctxt);
-    if (type == NULL) {
-        virReportError(VIR_ERR_XML_ERROR, "%s",
-                       _("storage pool missing type attribute"));
+    if (virXMLPropEnum(ctxt->node, "type", virStoragePoolTypeFromString,
+                       VIR_XML_PROP_REQUIRED, &type) < 0)
          return NULL;
-    }
- if ((def->type = virStoragePoolTypeFromString(type)) < 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("unknown storage pool type %s"), type);
-        return NULL;
-    }
+    def->type = type;
if ((options = virStoragePoolOptionsForPoolType(def->type)) == NULL)
          return NULL;





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux