mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
storage: gluster: Use volume name as "<name>" field in the XML
For native gluster pools the <dir> field denotes a directory inside the pool. For the actual pool name the <name> field has to be used.
This commit is contained in:
parent
5df6992e1c
commit
dff04e0af0
@ -2846,6 +2846,7 @@ virStorageUtilGlusterExtractPoolSources(const char *host,
|
|||||||
xmlXPathContextPtr ctxt = NULL;
|
xmlXPathContextPtr ctxt = NULL;
|
||||||
xmlNodePtr *nodes = NULL;
|
xmlNodePtr *nodes = NULL;
|
||||||
virStoragePoolSource *src = NULL;
|
virStoragePoolSource *src = NULL;
|
||||||
|
char *volname;
|
||||||
size_t i;
|
size_t i;
|
||||||
int nnodes;
|
int nnodes;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -2862,14 +2863,25 @@ virStorageUtilGlusterExtractPoolSources(const char *host,
|
|||||||
if (!(src = virStoragePoolSourceListNewSource(list)))
|
if (!(src = virStoragePoolSourceListNewSource(list)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(src->dir = virXPathString("string(./name)", ctxt))) {
|
if (!(volname = virXPathString("string(./name)", ctxt))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("failed to extract gluster volume name"));
|
_("failed to extract gluster volume name"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pooltype == VIR_STORAGE_POOL_NETFS)
|
if (pooltype == VIR_STORAGE_POOL_NETFS) {
|
||||||
src->format = VIR_STORAGE_POOL_NETFS_GLUSTERFS;
|
src->format = VIR_STORAGE_POOL_NETFS_GLUSTERFS;
|
||||||
|
src->dir = volname;
|
||||||
|
} else if (pooltype == VIR_STORAGE_POOL_GLUSTER) {
|
||||||
|
src->name = volname;
|
||||||
|
|
||||||
|
if (VIR_STRDUP(src->dir, "/") < 0)
|
||||||
|
goto cleanup;
|
||||||
|
} else {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("unsupported gluster lookup"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC_N(src->hosts, 1) < 0)
|
if (VIR_ALLOC_N(src->hosts, 1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<sources>
|
<sources>
|
||||||
<source>
|
<source>
|
||||||
<host name='testhost'/>
|
<host name='testhost'/>
|
||||||
<dir path='vol0'/>
|
<dir path='/'/>
|
||||||
|
<name>vol0</name>
|
||||||
</source>
|
</source>
|
||||||
</sources>
|
</sources>
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
<sources>
|
<sources>
|
||||||
<source>
|
<source>
|
||||||
<host name='testhost'/>
|
<host name='testhost'/>
|
||||||
<dir path='aaa'/>
|
<dir path='/'/>
|
||||||
|
<name>aaa</name>
|
||||||
</source>
|
</source>
|
||||||
<source>
|
<source>
|
||||||
<host name='testhost'/>
|
<host name='testhost'/>
|
||||||
<dir path='test'/>
|
<dir path='/'/>
|
||||||
|
<name>test</name>
|
||||||
</source>
|
</source>
|
||||||
<source>
|
<source>
|
||||||
<host name='testhost'/>
|
<host name='testhost'/>
|
||||||
<dir path='test1'/>
|
<dir path='/'/>
|
||||||
|
<name>test1</name>
|
||||||
</source>
|
</source>
|
||||||
</sources>
|
</sources>
|
||||||
|
Loading…
Reference in New Issue
Block a user