summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c52
-rw-r--r--cli/src/cli-cmd-volume.c2
-rw-r--r--cli/src/cli-rpc-ops.c19
3 files changed, 68 insertions, 5 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 4181e6c8162..f7ee29a10c7 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -159,13 +159,21 @@ 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", NULL };
+ char *opwords[] = { "replica", "stripe", "transport",
+#ifdef HAVE_BD_XLATOR
+ "device",
+#endif
+ NULL };
+
char *invalid_volnames[] = {"volume", "type", "subvolumes", "option",
"end-volume", "all", NULL};
char *w = NULL;
int op_count = 0;
int32_t replica_count = 1;
int32_t stripe_count = 1;
+#ifdef HAVE_BD_XLATOR
+ char *dev_type = NULL;
+#endif
GF_ASSERT (words);
GF_ASSERT (options);
@@ -300,7 +308,26 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
goto out;
}
index += 2;
- } else {
+ }
+#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 {
GF_ASSERT (!"opword mismatch");
ret = -1;
goto out;
@@ -336,6 +363,19 @@ 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 volumer 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 "
@@ -369,6 +409,14 @@ 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.c b/cli/src/cli-cmd-volume.c
index 5b02ef5d9fe..4dcb99ce26e 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1795,7 +1795,7 @@ struct cli_cmd volume_cmds[] = {
cli_cmd_volume_info_cbk,
"list information of all volumes"},
- { "volume create <NEW-VOLNAME> [stripe <COUNT>] [replica <COUNT>] [transport <tcp|rdma|tcp,rdma>] <NEW-BRICK> ...",
+ { "volume create <NEW-VOLNAME> [stripe <COUNT>] [replica <COUNT>] [device vg] [transport <tcp|rdma|tcp,rdma>] <NEW-BRICK> ...",
cli_cmd_volume_create_cbk,
"create a new volume of specified type with mentioned bricks"},
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 703289b5b54..77e15ee296c 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -62,6 +62,10 @@ char *cli_vol_status_str[] = {"Created",
"Stopped",
};
+char *cli_volume_backend[] = {"",
+ "Volume Group",
+};
+
int32_t
gf_cli_get_volume (call_frame_t *frame, xlator_t *this,
void *data);
@@ -493,6 +497,7 @@ 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;
@@ -643,6 +648,9 @@ 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
@@ -654,16 +662,17 @@ 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),
stripe_count,
replica_count,
brick_count);
-
} else if (type == GF_CLUSTER_TYPE_NONE) {
cli_out ("Number of Bricks: %d", brick_count);
-
} else {
/* For both replicate and stripe, dist_count is
good enough */
@@ -676,6 +685,12 @@ 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);