summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-10-06 13:05:57 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-10-07 02:09:36 -0700
commitee944e86866a6556fd4dd98bcd6f1f58c323721f (patch)
tree59cf65a648877f50e8384bdd018e642d744ba7e1 /xlators/mgmt/glusterd/src/glusterd-brick-ops.c
parentff5ea98c6c0ffb7398562b418e8e9c422f08691d (diff)
glusterd/add-brick: change add-brick implementation to v3 framework
add-brick commit first happens on local node and followed by peers. As part of the commit of local-host glusterd will send the updated volfiles to the clients connected to the local-host even before the commit of peers happen. If any of the newly added brick was hosted by any peer, that brick won't be started when client (connected to local-host) try to send fops. By changing to v3 framework we can send post validate ops after commit operation that helps to send volfile fetch request only after completing commits on all nodes. Change-Id: Ib7312e01143326128c010c11fc2ed206f37409ad BUG: 1263549 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/12237 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c78
1 files changed, 67 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 8772dd1..fa652ac 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -14,10 +14,12 @@
#include "glusterd-op-sm.h"
#include "glusterd-geo-rep.h"
#include "glusterd-store.h"
+#include "glusterd-mgmt.h"
#include "glusterd-utils.h"
#include "glusterd-volgen.h"
#include "glusterd-svc-helper.h"
#include "glusterd-messages.h"
+#include "glusterd-server-quorum.h"
#include "run.h"
#include <sys/signal.h>
@@ -412,11 +414,16 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
int32_t replica_count = 0;
int32_t stripe_count = 0;
int type = 0;
+ glusterd_conf_t *conf = NULL;
+
this = THIS;
GF_ASSERT(this);
GF_ASSERT (req);
+ conf = this->private;
+ GF_ASSERT (conf);
+
ret = xdr_to_generic (req->msg[0], &cli_req,
(xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
@@ -635,7 +642,17 @@ brick_val:
}
}
- ret = glusterd_op_begin_synctask (req, GD_OP_ADD_BRICK, dict);
+ if (conf->op_version <= GD_OP_VERSION_3_7_5) {
+ gf_msg_debug (this->name, 0, "The cluster is operating at "
+ "version less than or equal to %d. Falling back "
+ "to syncop framework.",
+ GD_OP_VERSION_3_7_5);
+ ret = glusterd_op_begin_synctask (req, GD_OP_ADD_BRICK, dict);
+ } else {
+ ret = glusterd_mgmt_v3_initiate_all_phases (req,
+ GD_OP_ADD_BRICK,
+ dict);
+ }
out:
if (ret) {
@@ -1318,14 +1335,14 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count,
volinfo->subvol_count = (volinfo->brick_count /
volinfo->dist_leaf_count);
- ret = glusterd_create_volfiles (volinfo);
- if (ret)
- goto out;
-
ret = 0;
if (GLUSTERD_STATUS_STARTED != volinfo->status)
goto out;
+ ret = generate_brick_volfiles (volinfo);
+ if (ret)
+ goto out;
+
brick_list = gf_strdup (bricks);
free_ptr2 = brick_list;
i = 1;
@@ -1396,8 +1413,16 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count,
_glusterd_restart_gsync_session, &param);
}
volinfo->caps = caps;
-
- ret = glusterd_fetchspec_notify (this);
+ if (conf->op_version <= GD_OP_VERSION_3_7_5) {
+ ret = glusterd_create_volfiles_and_notify_services (volinfo);
+ } else {
+ /*
+ * The cluster is operating at version greater than
+ * gluster-3.7.5. So no need to sent volfile fetch
+ * request in commit phase, the same will be done
+ * in post validate phase with v3 framework.
+ */
+ }
out:
GF_FREE (free_ptr1);
@@ -1523,6 +1548,28 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
if (ret)
goto out;
+ if (conf->op_version > GD_OP_VERSION_3_7_5 &&
+ is_origin_glusterd (dict)) {
+ ret = glusterd_validate_quorum (this, GD_OP_ADD_BRICK, dict,
+ op_errstr);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_SERVER_QUORUM_NOT_MET,
+ "Server quorum not met. Rejecting operation.");
+ goto out;
+ }
+ } else {
+ /* Case 1: conf->op_version <= GD_OP_VERSION_3_7_5
+ * in this case the add-brick is running
+ * syncop framework that will do a quorum
+ * check by default
+ * Case 2: We don't need to do quorum check on every
+ * node, only originator glusterd need to
+ * check for quorum
+ * So nothing need to be done in else
+ */
+ }
+
if (glusterd_is_defrag_on(volinfo)) {
snprintf (msg, sizeof(msg), "Volume name %s rebalance is in "
"progress. Please retry after completion", volname);
@@ -2220,10 +2267,19 @@ glusterd_op_add_brick (dict_t *dict, char **op_errstr)
GD_MSG_BRICK_ADD_FAIL, "Unable to add bricks");
goto out;
}
-
- ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT);
- if (ret)
- goto out;
+ if (priv->op_version <= GD_OP_VERSION_3_7_5) {
+ ret = glusterd_store_volinfo (volinfo,
+ GLUSTERD_VOLINFO_VER_AC_INCREMENT);
+ if (ret)
+ goto out;
+ } else {
+ /*
+ * The cluster is operating at version greater than
+ * gluster-3.7.5. So no need to store volfiles
+ * in commit phase, the same will be done
+ * in post validate phase with v3 framework.
+ */
+ }
if (GLUSTERD_STATUS_STARTED == volinfo->status)
ret = glusterd_svcs_manager (volinfo);