[PATCH 2/5] conf: Support to parse rbd namespace attribute

Han Han hhan at redhat.com
Wed Apr 8 09:04:45 UTC 2020


Signed-off-by: Han Han <hhan at redhat.com>
---
 src/conf/domain_conf.c    | 4 ++++
 src/util/virstoragefile.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6ad7552b..a4ee2e1e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9488,6 +9488,7 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
 
     /* config file currently only works with remote disks */
     src->configFile = virXPathString("string(./config/@file)", ctxt);
+    src->namespace = virXPathString("string(./@namespace)", ctxt);
 
     if (src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTP ||
         src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS)
@@ -24614,6 +24615,9 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
         path = g_strdup_printf("%s/%s", src->volume, src->path);
 
     virBufferEscapeString(attrBuf, " name='%s'", path ? path : src->path);
+    if (src->namespace)
+        virBufferEscapeString(attrBuf, " namespace='%s'", src->namespace);
+
     virBufferEscapeString(attrBuf, " query='%s'", src->query);
 
     if (src->haveTLS != VIR_TRISTATE_BOOL_ABSENT &&
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 7939c09c..8b683b7e 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -284,6 +284,7 @@ struct _virStorageSource {
     char *snapshot; /* for storage systems supporting internal snapshots */
     char *configFile; /* some storage systems use config file as part of
                          the source definition */
+    char *namespace; /* for the storage systems supporting namespace */
     char *query; /* query string for HTTP based protocols */
     size_t nhosts;
     virStorageNetHostDefPtr hosts;
-- 
2.25.0




More information about the libvir-list mailing list