[PATCH v3 2/5] conf: Support to parse rbd namespace attribute
Han Han
hhan at redhat.com
Thu Aug 6 11:41:43 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 ef67efa1da..163c934428 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9601,6 +9601,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)
@@ -25083,6 +25084,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 f73b3ee005..0364fe5e7e 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.27.0
More information about the libvir-list
mailing list