提交 a92160db 编写于 作者: P Peter Krempa

storage: util: Pass pool type to virStorageBackendFindGlusterPoolSources

The native gluster pool source list data differs from the data used for
attaching gluster volumes as netfs pools. Currently the only difference
was the format. Since native pools don't use it and later there will be
more differences add a more deterministic way to switch between the
types instead.
上级 609cc5a8
...@@ -186,7 +186,7 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE ...@@ -186,7 +186,7 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE
retNFS = virStorageBackendFileSystemNetFindNFSPoolSources(&state); retNFS = virStorageBackendFileSystemNetFindNFSPoolSources(&state);
retGluster = virStorageBackendFindGlusterPoolSources(state.host, retGluster = virStorageBackendFindGlusterPoolSources(state.host,
VIR_STORAGE_POOL_NETFS_GLUSTERFS, VIR_STORAGE_POOL_NETFS,
&state.list, false); &state.list, false);
if (retGluster < 0) if (retGluster < 0)
......
...@@ -513,7 +513,7 @@ virStorageBackendGlusterFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, ...@@ -513,7 +513,7 @@ virStorageBackendGlusterFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
} }
if ((rc = virStorageBackendFindGlusterPoolSources(source->hosts[0].name, if ((rc = virStorageBackendFindGlusterPoolSources(source->hosts[0].name,
0, /* currently ignored */ VIR_STORAGE_POOL_GLUSTER,
&list, true)) < 0) &list, true)) < 0)
goto cleanup; goto cleanup;
......
...@@ -2839,17 +2839,21 @@ virStorageBackendDeleteLocal(virConnectPtr conn ATTRIBUTE_UNUSED, ...@@ -2839,17 +2839,21 @@ virStorageBackendDeleteLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
/** /**
* virStorageBackendFindGlusterPoolSources: * virStorageBackendFindGlusterPoolSources:
* @host: host to detect volumes on * @host: host to detect volumes on
* @pooltype: src->format is set to this value * @pooltype: type of the pool
* @list: list of storage pool sources to be filled * @list: list of storage pool sources to be filled
* @report: report error if the 'gluster' cli tool is missing * @report: report error if the 'gluster' cli tool is missing
* *
* Looks up gluster volumes on @host and fills them to @list. * Looks up gluster volumes on @host and fills them to @list.
* *
* @pooltype allows to influence the specific differences between netfs and
* native gluster pools. Users should pass only VIR_STORAGE_POOL_NETFS or
* VIR_STORAGE_POOL_GLUSTER.
*
* Returns number of volumes on the host on success, or -1 on error. * Returns number of volumes on the host on success, or -1 on error.
*/ */
int int
virStorageBackendFindGlusterPoolSources(const char *host, virStorageBackendFindGlusterPoolSources(const char *host,
int pooltype, virStoragePoolType pooltype,
virStoragePoolSourceListPtr list, virStoragePoolSourceListPtr list,
bool report) bool report)
{ {
...@@ -2911,14 +2915,15 @@ virStorageBackendFindGlusterPoolSources(const char *host, ...@@ -2911,14 +2915,15 @@ virStorageBackendFindGlusterPoolSources(const char *host,
goto cleanup; goto cleanup;
} }
if (pooltype == VIR_STORAGE_POOL_NETFS)
src->format = VIR_STORAGE_POOL_NETFS_GLUSTERFS;
if (VIR_ALLOC_N(src->hosts, 1) < 0) if (VIR_ALLOC_N(src->hosts, 1) < 0)
goto cleanup; goto cleanup;
src->nhost = 1; src->nhost = 1;
if (VIR_STRDUP(src->hosts[0].name, host) < 0) if (VIR_STRDUP(src->hosts[0].name, host) < 0)
goto cleanup; goto cleanup;
src->format = pooltype;
} }
ret = nnodes; ret = nnodes;
......
...@@ -94,7 +94,7 @@ int virStorageBackendRefreshLocal(virConnectPtr conn, ...@@ -94,7 +94,7 @@ int virStorageBackendRefreshLocal(virConnectPtr conn,
virStoragePoolObjPtr pool); virStoragePoolObjPtr pool);
int virStorageBackendFindGlusterPoolSources(const char *host, int virStorageBackendFindGlusterPoolSources(const char *host,
int pooltype, virStoragePoolType pooltype,
virStoragePoolSourceListPtr list, virStoragePoolSourceListPtr list,
bool report); bool report);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册