summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c19
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h3
4 files changed, 27 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index fca5857cc93..3c4516b76e0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -3826,8 +3826,9 @@ set_probe_error_str (int op_ret, int op_errno, char *op_errstr, char *errstr,
} else {
switch (op_errno) {
case GF_PROBE_ANOTHER_CLUSTER:
- snprintf (errstr, len, "%s is already part of "
- "another cluster", hostname);
+ snprintf (errstr, len, "%s is either already "
+ "part of another cluster or having "
+ "volumes configured", hostname);
break;
case GF_PROBE_VOLUME_CONFLICT:
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 755b7aab555..756e48965c2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -987,7 +987,7 @@ out:
/* Validate if glusterd can serve the management handshake request
*
* Requests are allowed if,
- * - glusterd has no peers, or
+ * - glusterd has no peers & no volumes, or
* - the request came from a known peer
* A known peer is identified using the following steps
* - the dict is checked for a peer uuid, which if present is matched with the
@@ -1007,7 +1007,7 @@ gd_validate_mgmt_hndsk_req (rpcsvc_request_t *req, dict_t *dict)
this = THIS;
GF_ASSERT (this);
- if (!glusterd_have_peers ())
+ if (!glusterd_have_peers () && !glusterd_have_volumes ())
return _gf_true;
ret = dict_get_str (dict, GD_PEER_ID_KEY, &uuid_str);
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 1c32201202a..848d0cce462 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -4542,6 +4542,25 @@ glusterd_all_volumes_with_quota_stopped ()
return _gf_true;
}
+gf_boolean_t
+glusterd_have_volumes ()
+{
+ xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
+ gf_boolean_t volumes_exist = _gf_false;
+
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("glusterd", (this != NULL), out);
+
+ priv = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, (priv != NULL), out);
+
+
+ volumes_exist = !cds_list_empty (&priv->volumes);
+out:
+ return volumes_exist;
+}
+
int
glusterd_volume_count_get (void)
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 8636e46bf57..622a6352b22 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -626,6 +626,9 @@ glusterd_check_client_op_version_support (char *volname, uint32_t op_version,
gf_boolean_t
glusterd_have_peers ();
+gf_boolean_t
+glusterd_have_volumes ();
+
void
glusterd_get_rebalance_volfile (glusterd_volinfo_t *volinfo,
char *path, int path_len);