[libvirt] [PATCH 20/21] conf: storage: use virXMLNamespaceRegister

Ján Tomko jtomko at redhat.com
Tue Aug 20 23:15:42 UTC 2019


Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/conf/storage_conf.c           | 2 ++
 src/storage/storage_backend_fs.c  | 9 ---------
 src/storage/storage_backend_rbd.c | 9 ---------
 3 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 6588d5c8ef..b5451e447f 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -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;
     }
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 4bed6df0bb..d947beac2c 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -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;
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 2d6c51de35..22caa189d7 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -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;
-- 
2.19.2




More information about the libvir-list mailing list