summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2012-04-11 15:30:22 +0530
committerVijay Bellur <vijay@gluster.com>2012-04-13 00:46:59 -0700
commitbada6aeb2cabd12a11b0fe17bb01e9f2045b013d (patch)
tree52482d74a792309afd753e0942e561cb0e8eb8bf
parentd80846bee0621f591a7b519743e4d91a620ccdca (diff)
glusterd/remove-brick: Replace ABORT with STOP
Remove-brick stop now invokes rebalance stop. This leads to a graceful stop of decommissioning. The volfile is also updated (removal of decommission) Change-Id: I5a8f725c0f54439b810ce32d988c21c02229c703 BUG: 811513 Signed-off-by: shishir gowda <shishirng@gluster.com> Reviewed-on: http://review.gluster.com/3126 Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--cli/src/cli-cmd-parser.c6
-rw-r--r--cli/src/cli-rpc-ops.c11
-rw-r--r--rpc/xdr/src/cli1-xdr.h2
-rw-r--r--rpc/xdr/src/cli1-xdr.x2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c19
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c36
6 files changed, 50 insertions, 26 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index dd7ab03bdb9..2aba56b9b3d 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -849,7 +849,7 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount,
char *tmp_brick = NULL;
char *tmp_brick1 = NULL;
char *type_opword[] = { "replica", NULL };
- char *opwords[] = { "start", "commit", "abort", "status",
+ char *opwords[] = { "start", "commit", "stop", "status",
"force", NULL };
char *w = NULL;
int32_t command = GF_OP_CMD_NONE;
@@ -911,8 +911,8 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount,
command = GF_OP_CMD_COMMIT;
if (question)
*question = 1;
- } else if (!strcmp ("abort", w)) {
- command = GF_OP_CMD_ABORT;
+ } else if (!strcmp ("stop", w)) {
+ command = GF_OP_CMD_STOP;
} else if (!strcmp ("status", w)) {
command = GF_OP_CMD_STATUS;
} else if (!strcmp ("force", w)) {
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 1ecb562bdc1..a7450c32e60 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -1592,9 +1592,6 @@ gf_cli3_1_remove_brick_cbk (struct rpc_req *req, struct iovec *iov,
case GF_OP_CMD_COMMIT:
cmd_str = "commit";
break;
- case GF_OP_CMD_ABORT:
- cmd_str = "abort";
- break;
case GF_OP_CMD_COMMIT_FORCE:
cmd_str = "commit force";
break;
@@ -2897,7 +2894,8 @@ gf_cli3_1_remove_brick (call_frame_t *frame, xlator_t *this,
if (ret)
goto out;
- if (command != GF_OP_CMD_STATUS) {
+ if ((command != GF_OP_CMD_STATUS) &&
+ (command != GF_OP_CMD_STOP)) {
ret = dict_allocate_and_serialize (dict,
&req.dict.dict_val,
@@ -2927,7 +2925,10 @@ gf_cli3_1_remove_brick (call_frame_t *frame, xlator_t *this,
goto out;
}
- cmd |= GF_DEFRAG_CMD_STATUS;
+ if (command == GF_OP_CMD_STATUS)
+ cmd |= GF_DEFRAG_CMD_STATUS;
+ else
+ cmd |= GF_DEFRAG_CMD_STOP;
ret = dict_set_int32 (req_dict, "rebalance-command", (int32_t) cmd);
if (ret) {
diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h
index 638a4ad7544..234f0f7f797 100644
--- a/rpc/xdr/src/cli1-xdr.h
+++ b/rpc/xdr/src/cli1-xdr.h
@@ -83,7 +83,7 @@ enum gf1_op_commands {
GF_OP_CMD_NONE = 0,
GF_OP_CMD_START = 0 + 1,
GF_OP_CMD_COMMIT = 0 + 2,
- GF_OP_CMD_ABORT = 0 + 3,
+ GF_OP_CMD_STOP = 0 + 3,
GF_OP_CMD_STATUS = 0 + 4,
GF_OP_CMD_COMMIT_FORCE = 0 + 5,
};
diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x
index 8b8c1920b0d..61af3a14cbf 100644
--- a/rpc/xdr/src/cli1-xdr.x
+++ b/rpc/xdr/src/cli1-xdr.x
@@ -35,7 +35,7 @@
GF_OP_CMD_NONE = 0,
GF_OP_CMD_START,
GF_OP_CMD_COMMIT,
- GF_OP_CMD_ABORT,
+ GF_OP_CMD_STOP,
GF_OP_CMD_STATUS,
GF_OP_CMD_COMMIT_FORCE
} ;
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 24ddc02ac0f..9754049073b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -1256,7 +1256,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
break;
}
- case GF_OP_CMD_ABORT:
+ case GF_OP_CMD_STOP:
+ ret = 0;
break;
case GF_OP_CMD_COMMIT:
@@ -1459,9 +1460,6 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
int32_t replica_count = 0;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_brickinfo_t *tmp = NULL;
- glusterd_conf_t *priv = NULL;
- char pidfile[PATH_MAX];
-
ret = dict_get_str (dict, "volname", &volname);
@@ -1492,19 +1490,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
ret = 0;
goto out;
- case GF_OP_CMD_ABORT:
+ case GF_OP_CMD_STOP:
{
- if (volinfo->decommission_in_progress) {
- priv = THIS->private;
- if (!priv)
- return ret;
-
- GLUSTERD_GET_DEFRAG_PID_FILE(pidfile, volinfo, priv);
-
- glusterd_service_stop ("rebalance", pidfile, SIGTERM, 1);
-
- }
-
/* Fall back to the old volume file */
list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
brick_list) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index e8e75c24077..e3c4c47411f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -41,6 +41,7 @@
#include "glusterd-utils.h"
#include "glusterd-store.h"
#include "run.h"
+#include "glusterd-volgen.h"
#include "syscall.h"
#include "cli1-xdr.h"
@@ -596,6 +597,9 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
char msg[2048] = {0};
glusterd_volinfo_t *volinfo = NULL;
glusterd_conf_t *priv = NULL;
+ glusterd_brickinfo_t *brickinfo = NULL;
+ glusterd_brickinfo_t *tmp = NULL;
+ gf_boolean_t volfile_update = _gf_false;
priv = THIS->private;
@@ -626,6 +630,38 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
cmd, NULL);
break;
case GF_DEFRAG_CMD_STOP:
+ /* Fall back to the old volume file in case of decommission*/
+ list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
+ brick_list) {
+ if (!brickinfo->decommissioned)
+ continue;
+ brickinfo->decommissioned = 0;
+ volfile_update = _gf_true;
+ }
+
+ if (volfile_update == _gf_false) {
+ ret = 0;
+ break;
+ }
+
+ ret = glusterd_create_volfiles_and_notify_services (volinfo);
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_WARNING,
+ "failed to create volfiles");
+ goto out;
+ }
+
+ ret = glusterd_store_volinfo (volinfo,
+ GLUSTERD_VOLINFO_VER_AC_INCREMENT);
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_WARNING,
+ "failed to store volinfo");
+ goto out;
+ }
+
+ ret = 0;
+ break;
+
case GF_DEFRAG_CMD_STATUS:
break;
default: