]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: storage: use virXMLNamespaceRegister
authorJán Tomko <jtomko@redhat.com>
Tue, 20 Aug 2019 22:18:55 +0000 (00:18 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 21 Aug 2019 08:29:21 +0000 (10:29 +0200)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/conf/storage_conf.c
src/storage/storage_backend_fs.c
src/storage/storage_backend_rbd.c

index fc5f0ccc3e31696be6f4adf12da70363256b0747..024f047fabdecb8b0e6907ddd8e1bd3da1dbf3f3 100644 (file)
@@ -998,6 +998,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
      * especially during the virStoragePoolSourceClear method */
     def->ns = options->ns;
     if (def->ns.parse) {
+        if (virXMLNamespaceRegister(ctxt, &def->ns) < 0)
+            return NULL;
         if ((def->ns.parse)(ctxt, &def->namespaceData) < 0)
             return NULL;
     }
index 4bed6df0bbb2346db271f2c36379b2bf83b5eda9..d947beac2c40ae206e1501d5fd8174dbc7a5f641 100644 (file)
@@ -41,7 +41,6 @@ VIR_LOG_INIT("storage.storage_backend_fs");
 
 #if WITH_STORAGE_FS
 
-# include <libxml/xpathInternals.h>
 # include <mntent.h>
 
 struct _virNetfsDiscoverState {
@@ -571,14 +570,6 @@ virStoragePoolDefFSNamespaceParse(xmlXPathContextPtr ctxt,
     int ret = -1;
     VIR_AUTOFREE(xmlNodePtr *)nodes = NULL;
 
-    if (xmlXPathRegisterNs(ctxt, BAD_CAST "fs",
-                           BAD_CAST STORAGE_POOL_FS_NAMESPACE_HREF) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to register xml namespace '%s'"),
-                       STORAGE_POOL_FS_NAMESPACE_HREF);
-        return -1;
-    }
-
     nnodes = virXPathNodeSet("./fs:mount_opts/fs:option", ctxt, &nodes);
     if (nnodes < 0)
         return -1;
index 2d6c51de35563e66efe28d1c123a8ce738783772..22caa189d73446a182e0d54efee1dd9e2c83e396 100644 (file)
@@ -36,7 +36,6 @@
 #include "rbd/librbd.h"
 #include "secret_util.h"
 #include "storage_util.h"
-#include <libxml/xpathInternals.h>
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
@@ -91,14 +90,6 @@ virStoragePoolDefRBDNamespaceParse(xmlXPathContextPtr ctxt,
     int ret = -1;
     VIR_AUTOFREE(xmlNodePtr *)nodes = NULL;
 
-    if (xmlXPathRegisterNs(ctxt, BAD_CAST "rbd",
-                           BAD_CAST STORAGE_POOL_RBD_NAMESPACE_HREF) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to register xml namespace '%s'"),
-                       STORAGE_POOL_RBD_NAMESPACE_HREF);
-        return -1;
-    }
-
     nnodes = virXPathNodeSet("./rbd:config_opts/rbd:option", ctxt, &nodes);
     if (nnodes < 0)
         return -1;