diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 8a7d7e5314bab6ea828df81bc541e04dba85e891..b79b6342045b1903725518f43384e2038d744279 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -571,9 +571,17 @@ virStorageFileBackendGlusterInit(virStorageSourcePtr src) { virStorageFileBackendGlusterPrivPtr priv = NULL; virStorageNetHostDefPtr host = &(src->hosts[0]); - const char *hostname = host->name; + const char *hostname; int port = 0; + if (src->nhosts != 1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Expected exactly 1 host for the gluster volume")); + return -1; + } + + hostname = host->name; + VIR_DEBUG("initializing gluster storage file %p (gluster://%s:%s/%s%s)", src, hostname, host->port ? host->port : "0", NULLSTR(src->volume), src->path);