summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorM. Mohan Kumar <mohan@in.ibm.com>2013-11-13 22:44:42 +0530
committerAnand Avati <avati@redhat.com>2013-11-13 11:38:28 -0800
commit15a8ecd9b3eedf80881bd3dba81f16b7d2cb7c97 (patch)
tree856377a3f077ac4ea5cb9db2950210c8d9f30fb1 /cli/src
parentc1109ed6c6c7bff0df22c304158e9f392f83cf59 (diff)
bd_map: Remove bd_map xlator
Remove bd_map xlator and CLI related changes. Change-Id: If7086205df1907127c1a1fa4ba603f1c48421d09 BUG: 1028672 Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Reviewed-on: http://review.gluster.org/5747 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/Makefile.am3
-rw-r--r--cli/src/cli-cmd-misc.c3
-rw-r--r--cli/src/cli-cmd-parser.c51
-rw-r--r--cli/src/cli-cmd-volume-bdevice.c270
-rw-r--r--cli/src/cli-cmd-volume.c3
-rw-r--r--cli/src/cli-cmd.c5
-rw-r--r--cli/src/cli-cmd.h3
-rw-r--r--cli/src/cli-rpc-ops.c156
-rw-r--r--cli/src/cli.h13
9 files changed, 2 insertions, 505 deletions
diff --git a/cli/src/Makefile.am b/cli/src/Makefile.am
index ae52310264d..d5189da5e8c 100644
--- a/cli/src/Makefile.am
+++ b/cli/src/Makefile.am
@@ -3,9 +3,6 @@ sbin_PROGRAMS = gluster
gluster_SOURCES = cli.c registry.c input.c cli-cmd.c cli-rl.c \
cli-cmd-volume.c cli-cmd-peer.c cli-rpc-ops.c cli-cmd-parser.c\
cli-cmd-system.c cli-cmd-misc.c cli-xml-output.c
-if ENABLE_BD_XLATOR
-gluster_SOURCES += cli-cmd-volume-bdevice.c
-endif
gluster_LDADD = $(top_builddir)/libglusterfs/src/libglusterfs.la $(GF_LDADD)\
$(RLLIBS) $(top_builddir)/rpc/xdr/src/libgfxdr.la \
diff --git a/cli/src/cli-cmd-misc.c b/cli/src/cli-cmd-misc.c
index 5f3a77ca67f..4aec8dd35b4 100644
--- a/cli/src/cli-cmd-misc.c
+++ b/cli/src/cli-cmd-misc.c
@@ -47,9 +47,6 @@ cli_cmd_display_help (struct cli_state *state, struct cli_cmd_word *in_word,
{
struct cli_cmd *cmd[] = {volume_cmds, cli_probe_cmds,
cli_misc_cmds,
-#ifdef HAVE_BD_XLATOR
- cli_bd_cmds,
-#endif
NULL};
struct cli_cmd *cmd_ind = NULL;
int i = 0;
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 5278a3ebfcb..cd0370acc78 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -159,11 +159,7 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
int32_t index = 0;
char *bricks = NULL;
int32_t brick_count = 0;
- char *opwords[] = { "replica", "stripe", "transport",
-#ifdef HAVE_BD_XLATOR
- "device",
-#endif
- NULL };
+ char *opwords[] = { "replica", "stripe", "transport", NULL };
char *invalid_volnames[] = {"volume", "type", "subvolumes", "option",
"end-volume", "all", "volume_not_in_ring",
@@ -172,9 +168,6 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
int op_count = 0;
int32_t replica_count = 1;
int32_t stripe_count = 1;
-#ifdef HAVE_BD_XLATOR
- char *dev_type = NULL;
-#endif
gf_boolean_t is_force = _gf_false;
int wc = wordcount;
@@ -311,26 +304,7 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
goto out;
}
index += 2;
- }
-#ifdef HAVE_BD_XLATOR
- else if ((strcmp (w, "device")) == 0) {
- if (dev_type) {
- cli_err ("'device' option given more"
- " than one time");
- goto out;
- }
- if ((strcasecmp (words[index+1], "vg") == 0)) {
- dev_type = gf_strdup ("vg");
- } else {
- gf_log ("", GF_LOG_ERROR, "incorrect"
- " device type specified");
- ret = -1;
- goto out;
- }
- index += 2;
- }
-#endif
- else {
+ } else {
GF_ASSERT (!"opword mismatch");
ret = -1;
goto out;
@@ -371,19 +345,6 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
goto out;
}
- /* BD xlator does not support multiple bricks */
-#ifdef HAVE_BD_XLATOR
- if (brick_count > 1 && dev_type) {
- cli_err ("Block Device backend volume does not support multiple"
- " bricks");
- gf_log ("", GF_LOG_ERROR,
- "Block Device backend volume does not support multiple"
- " bricks");
- ret = -1;
- goto out;
- }
-#endif
-
if (brick_count % sub_count) {
if (type == GF_CLUSTER_TYPE_STRIPE)
cli_err ("number of bricks is not a multiple of "
@@ -417,14 +378,6 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
if (ret)
goto out;
-#ifdef HAVE_BD_XLATOR
- if (dev_type) {
- ret = dict_set_dynstr (dict, "device", dev_type);
- if (ret)
- goto out;
- }
-#endif
-
ret = dict_set_int32 (dict, "count", brick_count);
if (ret)
goto out;
diff --git a/cli/src/cli-cmd-volume-bdevice.c b/cli/src/cli-cmd-volume-bdevice.c
deleted file mode 100644
index 19325754fb9..00000000000
--- a/cli/src/cli-cmd-volume-bdevice.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- CLI for BD translator
-
- Copyright IBM, Corp. 2012
-
- This file is part of GlusterFS.
-
- Author:
- M. Mohan Kumar <mohan@in.ibm.com>
-
- This file is licensed to you under your choice of the GNU Lesser
- General Public License, version 3 or any later version (LGPLv3 or
- later), or the GNU General Public License, version 2 (GPLv2), in all
- cases as published by the Free Software Foundation.
-*/
-
-#ifndef _CONFIG_H
-#define _CONFIG_H
-#include "config.h"
-#endif
-
-#include "cli.h"
-#include "cli-cmd.h"
-#include <string.h>
-
-extern rpc_clnt_prog_t *cli_rpc_prog;
-
-int
-cli_cmd_bd_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
- const char **words, int wordcount);
-
-int32_t
-cli_cmd_bd_parse (dict_t *dict, const char **words)
-{
- char *volname = NULL;
- char *buff = NULL;
- char *buffp = NULL;
- int ret = -1;
- char *save = NULL;
- char *path = NULL;
- char *size = NULL;
- char *eptr = NULL;
- gf_xl_bd_op_t bd_op = GF_BD_OP_INVALID;
- char *dest_lv = NULL;
-
-
- /* volname:/path */
- if (!strchr (words[2], ':') || !strchr (words[2], '/')) {
- cli_out ("invalid parameter %s, needs <volname:/path>",
- words[2]);
- return -1;
- }
- buff = buffp = gf_strdup (words[2]);
- volname = strtok_r (buff, ":", &save);
- path = strtok_r (NULL, ":", &save);
-
- ret = dict_set_dynstr (dict, "volname", gf_strdup (volname));
- if (ret)
- goto out;
-
- ret = dict_set_dynstr (dict, "path", gf_strdup (path));
- if (ret)
- goto out;
-
- if (!strcasecmp (words[1], "create"))
- bd_op = GF_BD_OP_NEW_BD;
- else if (!strcasecmp (words[1], "delete"))
- bd_op = GF_BD_OP_DELETE_BD;
- else if (!strcasecmp (words[1], "clone"))
- bd_op = GF_BD_OP_CLONE_BD;
- else if (!strcasecmp (words[1], "snapshot"))
- bd_op = GF_BD_OP_SNAPSHOT_BD;
- else
- return -1;
-
- ret = dict_set_int32 (dict, "bd-op", bd_op);
- if (ret)
- goto out;
-
- if (bd_op == GF_BD_OP_NEW_BD) {
- /* If no suffix given we will treat it as MB */
- strtoull (words[3], &eptr, 0);
- /* no suffix */
- if (!eptr[0])
- gf_asprintf (&size, "%sMB", words[3]);
- else
- size = gf_strdup (words[3]);
-
- ret = dict_set_dynstr (dict, "size", size);
- if (ret)
- goto out;
- } else if (bd_op == GF_BD_OP_SNAPSHOT_BD ||
- bd_op == GF_BD_OP_CLONE_BD) {
- /*
- * dest_lv should be just dest_lv, we don't support
- * cloning/snapshotting to a different volume or vg
- */
- if (strchr (words[3], ':') || strchr (words[3], '/')) {
- cli_err ("invalid parameter %s, volname/vg not needed",
- words[3]);
- ret = -1;
- goto out;
- }
- dest_lv = gf_strdup (words[3]);
- ret = dict_set_dynstr (dict, "dest_lv", dest_lv);
- if (ret)
- goto out;
-
- /* clone needs size as parameter */
- if (bd_op == GF_BD_OP_SNAPSHOT_BD) {
- ret = dict_set_dynstr (dict, "size",
- gf_strdup (words[4]));
- if (ret)
- goto out;
- }
- }
-
- ret = 0;
-out:
- GF_FREE (buffp);
- return ret;
-}
-
-/*
- * bd create <volname>:/path <size>
- * bd delete <volname>:/path
- * bd clone <volname>:/path <newbd>
- * bd snapshot <volname>:/<path> <newbd> <size>
- */
-int32_t
-cli_cmd_bd_validate (const char **words, int wordcount, dict_t **options)
-{
- dict_t *dict = NULL;
- int ret = -1;
- char *op[] = { "create", "delete", "clone", "snapshot", NULL };
- int index = 0;
-
- for (index = 0; op[index]; index++)
- if (!strcasecmp (words[1], op[index]))
- break;
-
- if (!op[index])
- return -1;
-
- dict = dict_new ();
- if (!dict)
- goto out;
-
- if (!strcasecmp (words[1], "create")) {
- if (wordcount != 4)
- goto out;
- } else if (!strcasecmp (words[1], "delete")) {
- if (wordcount != 3)
- goto out;
- } else if (!strcasecmp (words[1], "clone")) {
- if (wordcount != 4)
- goto out;
- } else if (!strcasecmp (words[1], "snapshot")) {
- if (wordcount != 5)
- goto out;
- } else {
- ret = -1;
- goto out;
- }
-
- ret = cli_cmd_bd_parse (dict, words);
- if (ret < 0)
- goto out;
-
- *options = dict;
- ret = 0;
-out:
- if (ret)
- dict_unref (dict);
- return ret;
-}
-
-int
-cli_cmd_bd_cbk (struct cli_state *state, struct cli_cmd_word *word,
- const char **words, int wordcount)
-{
- int ret = -1;
- rpc_clnt_procedure_t *proc = NULL;
- call_frame_t *frame = NULL;
- int sent = 0;
- int parse_error = 0;
- dict_t *options = NULL;
- cli_local_t *local = NULL;
-
- proc = &cli_rpc_prog->proctable[GLUSTER_CLI_BD_OP];
-
- frame = create_frame (THIS, THIS->ctx->pool);
- if (!frame)
- goto out;
-
- ret = cli_cmd_bd_validate (words, wordcount, &options);
- if (ret) {
- cli_usage_out (word->pattern);
- parse_error = 1;
- goto out;
- }
-
- CLI_LOCAL_INIT (local, words, frame, options);
- if (proc->fn) {
- ret = proc->fn (frame, THIS, options);
- }
-
-out:
- if (options)
- dict_unref (options);
-
- if (ret) {
- cli_cmd_sent_status_get (&sent);
- if ((sent == 0) && (parse_error == 0))
- cli_out ("BD op failed!");
- }
-
- CLI_STACK_DESTROY (frame);
-
- return ret;
-}
-
-struct cli_cmd cli_bd_cmds[] = {
- { "bd help",
- cli_cmd_bd_help_cbk,
- "display help for bd command"},
- { "bd create <volname>:<bd> <size>",
- cli_cmd_bd_cbk,
- "\n\tcreate a block device where size can be "
- "suffixed with KB, MB etc. Default size is in MB"},
- { "bd delete <volname>:<bd>",
- cli_cmd_bd_cbk,
- "Delete a block device"},
- { "bd clone <volname>:<bd> <newbd>",
- cli_cmd_bd_cbk,
- "clone device"},
- { "bd snapshot <volname>:<bd> <newbd> <size>",
- cli_cmd_bd_cbk,
- "\n\tsnapshot device where size can be "
- "suffixed with KB, MB etc. Default size is in MB"},
- { NULL, NULL, NULL }
-};
-
-int
-cli_cmd_bd_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
- const char **words, int wordcount)
-{
- struct cli_cmd *cmd = NULL;
-
- for (cmd = cli_bd_cmds; cmd->pattern; cmd++)
- if (_gf_false == cmd->disable)
- cli_out ("%s - %s", cmd->pattern, cmd->desc);
-
- return 0;
-}
-
-int
-cli_cmd_bd_register (struct cli_state *state)
-{
- int ret = 0;
- struct cli_cmd *cmd = NULL;
-
- for (cmd = cli_bd_cmds; cmd->pattern; cmd++) {
- ret = cli_cmd_register (&state->tree, cmd);
- if (ret)
- goto out;
- }
-out:
- return ret;
-}
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 4b4bd02d286..dcb317f54fc 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1829,9 +1829,6 @@ struct cli_cmd volume_cmds[] = {
"list information of all volumes"},
{ "volume create <NEW-VOLNAME> [stripe <COUNT>] [replica <COUNT>] "
-#ifdef HAVE_BD_XLATOR
- "[device vg] "
-#endif
"[transport <tcp|rdma|tcp,rdma>] <NEW-BRICK> ... [force]",
cli_cmd_volume_create_cbk,
"create a new volume of specified type with mentioned bricks"},
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c
index aa7600350c1..1045f34f0f5 100644
--- a/cli/src/cli-cmd.c
+++ b/cli/src/cli-cmd.c
@@ -231,11 +231,6 @@ cli_cmds_register (struct cli_state *state)
if (ret)
goto out;
-#ifdef HAVE_BD_XLATOR
- ret = cli_cmd_bd_register (state);
- if (ret)
- goto out;
-#endif
out:
return ret;
}
diff --git a/cli/src/cli-cmd.h b/cli/src/cli-cmd.h
index 0ad37d49843..06a1ed32aac 100644
--- a/cli/src/cli-cmd.h
+++ b/cli/src/cli-cmd.h
@@ -119,7 +119,4 @@ gf_answer_t
cli_cmd_get_confirmation (struct cli_state *state, const char *question);
int cli_cmd_sent_status_get (int *status);
-#ifdef HAVE_BD_XLATOR
-int cli_cmd_bd_register (struct cli_state *state);
-#endif
#endif /* __CLI_CMD_H__ */
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 6ecb423385d..0ff997dc55e 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -58,10 +58,6 @@ char *cli_vol_status_str[] = {"Created",
"Stopped",
};
-char *cli_volume_backend[] = {"",
- "Volume Group",
-};
-
char *cli_vol_task_status_str[] = {"not started",
"in progress",
"stopped",
@@ -500,7 +496,6 @@ gf_cli_get_volume_cbk (struct rpc_req *req, struct iovec *iov,
char key[1024] = {0};
char err_str[2048] = {0};
gf_cli_rsp rsp = {0};
- int32_t backend = 0;
if (-1 == req->rpc_status)
goto out;
@@ -652,9 +647,6 @@ xml_output:
if (ret)
goto out;
- snprintf (key, 256, "volume%d.backend", i);
- ret = dict_get_int32 (dict, key, &backend);
-
vol_type = type;
// Distributed (stripe/replicate/stripe-replica) setups
@@ -666,9 +658,6 @@ xml_output:
cli_out ("Volume ID: %s", volume_id_str);
cli_out ("Status: %s", cli_vol_status_str[status]);
- if (backend)
- goto next;
-
if (type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) {
cli_out ("Number of Bricks: %d x %d x %d = %d",
(brick_count / dist_count),
@@ -689,12 +678,6 @@ xml_output:
((transport == 0)?"tcp":
(transport == 1)?"rdma":
"tcp,rdma"));
-
-next:
- if (backend) {
- cli_out ("Backend Type: Block, %s",
- cli_volume_backend[backend]);
- }
j = 1;
GF_FREE (local->get_vol.volname);
@@ -2932,142 +2915,6 @@ out:
return ret;
}
-#ifdef HAVE_BD_XLATOR
-int
-gf_cli_bd_op_cbk (struct rpc_req *req, struct iovec *iov,
- int count, void *myframe)
-{
- gf_cli_rsp rsp = {0,};
- int ret = -1;
- cli_local_t *local = NULL;
- dict_t *dict = NULL;
- dict_t *input_dict = NULL;
- gf_xl_bd_op_t bd_op = GF_BD_OP_INVALID;
- char *operation = NULL;
- call_frame_t *frame = NULL;
-
- if (-1 == req->rpc_status)
- goto out;
-
- frame = myframe;
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
- if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_ERROR,
- "Failed to decode xdr response");
- goto out;
- }
-
- dict = dict_new ();
- if (!dict) {
- ret = -1;
- goto out;
- }
-
- if (frame)
- local = frame->local;
-
- if (local) {
- input_dict = local->dict;
- ret = dict_get_int32 (input_dict, "bd-op",
- (int32_t *)&bd_op);
- }
-
- switch (bd_op) {
- case GF_BD_OP_NEW_BD:
- operation = gf_strdup ("create");
- break;
- case GF_BD_OP_DELETE_BD:
- operation = gf_strdup ("delete");
- break;
- case GF_BD_OP_CLONE_BD:
- operation = gf_strdup ("clone");
- break;
- case GF_BD_OP_SNAPSHOT_BD:
- operation = gf_strdup ("snapshot");
- break;
- default:
- break;
- }
-
- ret = dict_unserialize (rsp.dict.dict_val, rsp.dict.dict_len, &dict);
- if (ret)
- goto out;
-
- gf_log ("cli", GF_LOG_INFO, "Received resp to %s bd op", operation);
-
- if (global_state->mode & GLUSTER_MODE_XML) {
- ret = cli_xml_output_dict ("BdOp", dict, rsp.op_ret,
- rsp.op_errno, rsp.op_errstr);
- if (ret)
- gf_log ("cli", GF_LOG_ERROR,
- "Error outputting to xml");
- goto out;
- }
-
- if (rsp.op_ret && strcmp (rsp.op_errstr, ""))
- cli_err ("%s", rsp.op_errstr);
- else
- cli_out ("BD %s has been %s", operation,
- (rsp.op_ret) ? "unsuccessful":
- "successful.");
- ret = rsp.op_ret;
-
-out:
- cli_cmd_broadcast_response (ret);
-
- if (dict)
- dict_unref (dict);
-
- if (operation)
- GF_FREE (operation);
-
- if (rsp.dict.dict_val)
- free (rsp.dict.dict_val);
- if (rsp.op_errstr)
- free (rsp.op_errstr);
- return ret;
-}
-
-int32_t
-gf_cli_bd_op (call_frame_t *frame, xlator_t *this,
- void *data)
-{
- gf_cli_req req = { {0,} };
- int ret = 0;
- dict_t *dict = NULL;
-
- if (!frame || !this || !data) {
- ret = -1;
- goto out;
- }
-
- dict = dict_ref ((dict_t *)data);
- if (!dict)
- goto out;
-
- ret = dict_allocate_and_serialize (dict,
- &req.dict.dict_val,
- &req.dict.dict_len);
-
-
- ret = cli_to_glusterd (&req, frame, gf_cli_bd_op_cbk,
- (xdrproc_t)xdr_gf_cli_req, dict,
- GLUSTER_CLI_BD_OP, this, cli_rpc_prog,
- NULL);
-
-out:
- if (dict)
- dict_unref (dict);
-
- if (req.dict.dict_val)
- GF_FREE (req.dict.dict_val);
-
- gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
- return ret;
-}
-#endif
-
int32_t
gf_cli_create_volume (call_frame_t *frame, xlator_t *this,
void *data)
@@ -7740,9 +7587,6 @@ struct rpc_clnt_procedure gluster_cli_actors[GLUSTER_CLI_MAXVALUE] = {
[GLUSTER_CLI_CLRLOCKS_VOLUME] = {"CLEARLOCKS_VOLUME", gf_cli_clearlocks_volume},
[GLUSTER_CLI_COPY_FILE] = {"COPY_FILE", gf_cli_copy_file},
[GLUSTER_CLI_SYS_EXEC] = {"SYS_EXEC", gf_cli_sys_exec},
-#ifdef HAVE_BD_XLATOR
- [GLUSTER_CLI_BD_OP] = {"BD_OP", gf_cli_bd_op},
-#endif
};
struct rpc_clnt_program cli_prog = {
diff --git a/cli/src/cli.h b/cli/src/cli.h
index d7b64cfbf4d..bc71ee2b4f0 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -37,19 +37,6 @@
#define CLI_TAB_LENGTH 8
#define CLI_BRICK_STATUS_LINE_LEN 78
-#define CLI_LOCAL_INIT(local, words, frame, dictionary) \
- do { \
- local = cli_local_get (); \
- \
- if (local) { \
- local->words = words; \
- if (dictionary) \
- local->dict = dictionary; \
- if (frame) \
- frame->local = local; \
- } \
- } while (0)
-
enum argp_option_keys {
ARGP_DEBUG_KEY = 133,
ARGP_PORT_KEY = 'p',