From 891216e186b436444bc5368a96318df7364ce30a Mon Sep 17 00:00:00 2001 From: Pranith K Date: Tue, 9 Nov 2010 03:17:31 +0000 Subject: cli: remove volume type from add-brick and remove-brick cmds Signed-off-by: Pranith Kumar K Signed-off-by: Anand V. Avati BUG: 1983 ("type" in add-brick is completely redundant) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1983 --- cli/src/cli-cmd-parser.c | 67 ++---------------------------------------------- cli/src/cli-cmd-volume.c | 4 +-- cli/src/cli3_1-cops.c | 5 ---- rpc/xdr/src/cli1-xdr.c | 4 --- rpc/xdr/src/cli1-xdr.h | 2 -- rpc/xdr/src/cli1.x | 2 -- 6 files changed, 4 insertions(+), 80 deletions(-) diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 3780abefe5f..826717223b8 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -435,9 +435,6 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount, char *volname = NULL; char *delimiter = NULL; int ret = -1; - gf1_cluster_type type = GF_CLUSTER_TYPE_NONE; - int count = 0; - //char key[50] = {0,}; int brick_count = 0, brick_index = 0; int brick_list_size = 1; char brick_list[120000] = {0,}; @@ -477,36 +474,7 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount, goto out; } - if ((strcasecmp (words[3], "replica")) == 0) { - type = GF_CLUSTER_TYPE_REPLICATE; - if (wordcount < 5) { - ret = -1; - goto out; - } - - errno = 0; - count = strtol (words[4], NULL, 0); - if (errno == ERANGE && (count == LONG_MAX || count == LONG_MIN)) - goto out; - - brick_index = 5; - } else if ((strcasecmp (words[3], "stripe")) == 0) { - type = GF_CLUSTER_TYPE_STRIPE; - if (wordcount < 5) { - ret = -1; - goto out; - } - - errno = 0; - count = strtol (words[4], NULL, 0); - if (errno == ERANGE && (count == LONG_MAX || count == LONG_MIN)) - goto out; - - brick_index = 5; - } else { - brick_index = 3; - } - + brick_index = 3; strcpy (brick_list, " "); while (brick_index < wordcount) { delimiter = strchr (words[brick_index], ':'); @@ -610,8 +578,6 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount, char *volname = NULL; char *delimiter = NULL; int ret = -1; - gf1_cluster_type type = GF_CLUSTER_TYPE_NONE; - int count = 0; char key[50]; int brick_count = 0, brick_index = 0; int32_t tmp_index = 0; @@ -647,36 +613,7 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount, goto out; } - if ((strcasecmp (words[3], "replica")) == 0) { - type = GF_CLUSTER_TYPE_REPLICATE; - if (wordcount < 5) { - ret = -1; - goto out; - } - errno = 0; - count = strtol (words[4], NULL, 0); - if (errno == ERANGE && (count == LONG_MAX || count == LONG_MIN)) - goto out; - - brick_index = 5; - } else if ((strcasecmp (words[3], "stripe")) == 0) { - type = GF_CLUSTER_TYPE_STRIPE; - if (wordcount < 5) { - ret = -1; - goto out; - } - - errno = 0; - count = strtol (words[4], NULL, 0); - if (errno == ERANGE && (count == LONG_MAX || count == LONG_MIN)) - goto out; - - brick_index = 5; - } else { - brick_index = 3; - } - - ret = dict_set_int32 (dict, "type", type); + brick_index = 3; if (ret) goto out; diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index c2b819e68d9..7a210953991 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -910,11 +910,11 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_rename_cbk, "rename volume to "},*/ - { "volume add-brick [(replica )|(stripe )] ...", + { "volume add-brick ...", cli_cmd_volume_add_brick_cbk, "add brick to volume "}, - { "volume remove-brick [(replica )|(stripe )] ...", + { "volume remove-brick ...", cli_cmd_volume_remove_brick_cbk, "remove brick from volume "}, diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c index b2adb018826..dec20d904a5 100644 --- a/cli/src/cli3_1-cops.c +++ b/cli/src/cli3_1-cops.c @@ -1943,11 +1943,6 @@ gf_cli3_1_remove_brick (call_frame_t *frame, xlator_t *this, ret = dict_get_str (dict, "volname", &req.volname); - if (ret) - goto out; - - ret = dict_get_int32 (dict, "type", (int32_t *)&req.type); - if (ret) goto out; diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c index 2db0c7cc647..aff0edc3555 100644 --- a/rpc/xdr/src/cli1-xdr.c +++ b/rpc/xdr/src/cli1-xdr.c @@ -382,8 +382,6 @@ xdr_gf1_cli_add_brick_req (XDR *xdrs, gf1_cli_add_brick_req *objp) if (!xdr_string (xdrs, &objp->volname, ~0)) return FALSE; - if (!xdr_gf1_cluster_type (xdrs, &objp->type)) - return FALSE; if (!xdr_int (xdrs, &objp->count)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->bricks.bricks_val, (u_int *) &objp->bricks.bricks_len, ~0)) @@ -412,8 +410,6 @@ xdr_gf1_cli_remove_brick_req (XDR *xdrs, gf1_cli_remove_brick_req *objp) if (!xdr_string (xdrs, &objp->volname, ~0)) return FALSE; - if (!xdr_gf1_cluster_type (xdrs, &objp->type)) - return FALSE; if (!xdr_int (xdrs, &objp->count)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->bricks.bricks_val, (u_int *) &objp->bricks.bricks_len, ~0)) diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h index 38b5843fac0..5611f283d2d 100644 --- a/rpc/xdr/src/cli1-xdr.h +++ b/rpc/xdr/src/cli1-xdr.h @@ -229,7 +229,6 @@ typedef struct gf1_cli_defrag_vol_rsp gf1_cli_defrag_vol_rsp; struct gf1_cli_add_brick_req { char *volname; - gf1_cluster_type type; int count; struct { u_int bricks_len; @@ -248,7 +247,6 @@ typedef struct gf1_cli_add_brick_rsp gf1_cli_add_brick_rsp; struct gf1_cli_remove_brick_req { char *volname; - gf1_cluster_type type; int count; struct { u_int bricks_len; diff --git a/rpc/xdr/src/cli1.x b/rpc/xdr/src/cli1.x index 0ac34aea159..6c9f70dffbc 100644 --- a/rpc/xdr/src/cli1.x +++ b/rpc/xdr/src/cli1.x @@ -155,7 +155,6 @@ struct gf1_cli_get_vol_rsp { struct gf1_cli_add_brick_req { string volname<>; - gf1_cluster_type type; int count; opaque bricks<>; } ; @@ -169,7 +168,6 @@ struct gf1_cli_get_vol_rsp { struct gf1_cli_remove_brick_req { string volname<>; - gf1_cluster_type type; int count; opaque bricks<>; } ; -- cgit