if test "$with_storage_fs" = "yes" ||
test "$with_storage_gluster" = "yes"; then
- AC_PATH_PROG([GLUSTER_CLI], [gluster], [], [$LIBVIRT_SBIN_PATH])
+ AC_PATH_PROG([GLUSTER_CLI], [gluster], [gluster], [$LIBVIRT_SBIN_PATH])
if test "x$GLUSTER_CLI" != "x"; then
AC_DEFINE_UNQUOTED([GLUSTER_CLI], ["$GLUSTER_CLI"],
[Location or name of the gluster command line tool])
}
-#ifdef GLUSTER_CLI
/**
* virStorageBackendFindGlusterPoolSources:
* @host: host to detect volumes on
* @pooltype: src->format is set to this value
* @list: list of storage pool sources to be filled
+ * @report: report error if the 'gluster' cli tool is missing
*
* Looks up gluster volumes on @host and fills them to @list.
*
int
virStorageBackendFindGlusterPoolSources(const char *host,
int pooltype,
- virStoragePoolSourceListPtr list)
+ virStoragePoolSourceListPtr list,
+ bool report)
{
+ char *glusterpath = NULL;
char *outbuf = NULL;
virCommandPtr cmd = NULL;
xmlDocPtr doc = NULL;
int ret = -1;
- cmd = virCommandNewArgList(GLUSTER_CLI,
+ if (!(glusterpath = virFindFileInPath(GLUSTER_CLI))) {
+ if (report) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("'gluster' command line tool not found"));
+ return -1;
+ } else {
+ return 0;
+ }
+ }
+
+ cmd = virCommandNewArgList(glusterpath,
"--xml",
"--log-file=/dev/null",
"volume", "info", "all", NULL);
xmlFreeDoc(doc);
VIR_FREE(outbuf);
virCommandFree(cmd);
+ VIR_FREE(glusterpath);
return ret;
}
-#else /* #ifdef GLUSTER_CLI */
-int
-virStorageBackendFindGlusterPoolSources(const char *host ATTRIBUTE_UNUSED,
- int pooltype ATTRIBUTE_UNUSED,
- virStoragePoolSourceListPtr list ATTRIBUTE_UNUSED)
-{
- VIR_INFO("gluster cli tool not installed");
- return 0;
-}
-#endif /* #ifdef GLUSTER_CLI */
#if WITH_BLKID
int virStorageBackendFindGlusterPoolSources(const char *host,
int pooltype,
- virStoragePoolSourceListPtr list);
+ virStoragePoolSourceListPtr list,
+ bool report);
int virStorageBackendVolUploadLocal(virConnectPtr conn,
virStoragePoolObjPtr pool,
retNFS = virStorageBackendFileSystemNetFindNFSPoolSources(&state);
-# ifdef GLUSTER_CLI
retGluster = virStorageBackendFindGlusterPoolSources(state.host,
VIR_STORAGE_POOL_NETFS_GLUSTERFS,
- &state.list);
+ &state.list, false);
if (retGluster < 0)
goto cleanup;
-# endif
/* If both fail, then we won't return an empty list - return an error */
if (retNFS < 0 && retGluster == 0) {
virReportError(VIR_ERR_OPERATION_FAILED,