summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2017-04-17 17:41:02 +0530
committerPrasanna Kumar Kalever <pkalever@redhat.com>2017-05-04 14:16:22 +0000
commita31ee2d59d59c74e2a1b91dc40cd12b7c918a45c (patch)
tree24da6a6ab150feaf24898d2f1f248ca6b960db74 /cli
parent5d48aba7b65dfad09bfc639e3434f03227b8bd50 (diff)
login: one command for logging-in to all gateways of a target
Currently from the initiator side we need to login to mpath no. of nodes individually for establishing connect with all multipathed block devices from the client side, thus we need to execute mpath no. of login commands (i.e. login to each server) This can be minimized to single login command per target by configuring all gateways for a particular target in all gateways. Currently, $ gluster-block create VOL/BLOCK ha 3 HOSTx,HOSTy,HOSTz 10GiB Creates only one TPG i.e tpg1 (Read as Target Portal Group with Tag 1) on each node/server, with one portal listening on respective IP. All the gateways/nodes emulate same backend as target LUN with same WWN (for multipath representation) So at client side. we need to execute 3 commands to login all gateways $ iscsiadm -m discovery -t st -p HOSTy -l $ iscsiadm -m discovery -t st -p HOSTz -l $ iscsiadm -m discovery -t st -p HOSTx -l In the above case, user may login in any fashion, which is out of our control. Since we have failover multipath configuration, at a given time only one gateway can TX RX the data. so predicting active path/connection is not possible. With this patch, $ gluster-block create VOL/BLOCK ha 3 HOSTx,HOSTy,HOSTz 10GiB Creates 3 TPG's, tpg1(portal HOSTx), tpg2(portal HOSTy) and tpg3(portal HOSTz) on all the three gateways/nodes (IN same order). Basically, each gateway is define to every other gateway - but the other (other than local) gateway entries are in a disabled state. When the client starts the login sequence it issues the RPTG to the one nodes, but now that node can respond with portal IP's for all of the gateways. e.g. GW1 GW2 GW3 - tpg1/enabled - tpg1/disabled - tpg1/disabled - tpg2/disabled - tpg2/enabled - tpg2/disabled - tpg3/disabled - tpg3/disabled - tpg3/enabled Advantage, * Only one login command is needed, unlike 3 login's before, $ iscsiadm -m discovery -t st -p ANYONEHOST -l * Always tpg1 will be tried for making an active path/connection, hence we can predict that the first host in the list {HOSTx,HOSTy,HOSTz} will be tried for active connection. Hence we can be able to better manage load on each nodes, by selectively supplying Hosts in the list. Change-Id: I70f73b1d46812cb1bd8dc80f771ec20b0f0415bf Fixes: #9 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/gluster-block.c63
1 files changed, 28 insertions, 35 deletions
diff --git a/cli/gluster-block.c b/cli/gluster-block.c
index a980110..afa1262 100644
--- a/cli/gluster-block.c
+++ b/cli/gluster-block.c
@@ -34,15 +34,26 @@ const char *argp_program_version = "" \
"or later), or the GNU General Public License, version 2 (GPLv2),\n"\
"in all cases as published by the Free Software Foundation.";
-#define GB_CREATE_HELP_STR "gluster-block create <volname/blockname> "\
- "[ha <count>] [auth enable|disable] "\
- "<HOST1[,HOST2,...]> <size> [--json*]"
-#define GB_DELETE_HELP_STR "gluster-block delete <volname/blockname> [--json*]"
-#define GB_MODIFY_HELP_STR "gluster-block modify <volname/blockname> "\
- "<auth enable|disable> [--json*]"
-#define GB_INFO_HELP_STR "gluster-block info <volname/blockname> [--json*]"
-#define GB_LIST_HELP_STR "gluster-block list <volname> [--json*]"
+# define GB_CREATE_HELP_STR "gluster-block create <volname/blockname> "\
+ "[ha <count>] [auth enable|disable] "\
+ "<HOST1[,HOST2,...]> <size> [--json*]"
+
+# define GB_DELETE_HELP_STR "gluster-block delete <volname/blockname> [--json*]"
+# define GB_MODIFY_HELP_STR "gluster-block modify <volname/blockname> "\
+ "<auth enable|disable> [--json*]"
+# define GB_INFO_HELP_STR "gluster-block info <volname/blockname> [--json*]"
+# define GB_LIST_HELP_STR "gluster-block list <volname> [--json*]"
+
+
+# define GB_ARGCHECK_OR_RETURN(argcount, count, cmd, helpstr) \
+ do { \
+ if (argcount != count) { \
+ MSG("Inadequate arguments for %s:\n%s\n", cmd, helpstr);\
+ return -1; \
+ } \
+ } while(0)
+
static int
glusterBlockCliRPC_1(void *cobj, clioperations opt, char **out)
@@ -273,12 +284,10 @@ glusterBlockModify(int argcount, char **options, int json)
int ret = -1;
char *out = NULL;
+
+ GB_ARGCHECK_OR_RETURN(argcount, 5, "modify", GB_MODIFY_HELP_STR);
+
mobj.json_resp = json;
- if (argcount != 5) {
- MSG("%s\n", "Insufficient arguments for modify:");
- MSG("%s\n", GB_MODIFY_HELP_STR);
- return -1;
- }
if (glusterBlockParseVolumeBlock (options[optind++], mobj.volume,
mobj.block_name, GB_MODIFY_HELP_STR,
@@ -330,12 +339,11 @@ glusterBlockCreate(int argcount, char **options, int json)
blockCreateCli cobj = {0, };
- cobj.json_resp = json;
if (argcount <= optind) {
- MSG("%s\n", "Insufficient arguments for create:");
- MSG("%s\n", GB_CREATE_HELP_STR);
+ MSG("Inadequate arguments for create:\n%s\n", GB_CREATE_HELP_STR);
return -1;
}
+ cobj.json_resp = json;
/* default mpath */
cobj.mpath = 1;
@@ -375,8 +383,7 @@ glusterBlockCreate(int argcount, char **options, int json)
}
if (argcount - optind < 2) { /* left with servers and size so 2 */
- MSG("%s\n", "Insufficient arguments for create");
- MSG("%s\n", GB_CREATE_HELP_STR);
+ MSG("Inadequate arguments for create:\n%s\n", GB_CREATE_HELP_STR);
LOG("cli", GB_LOG_ERROR,
"failed creating block %s on volume %s with hosts %s",
cobj.block_name, cobj.volume, cobj.block_hosts);
@@ -428,12 +435,8 @@ glusterBlockList(int argcount, char **options, int json)
int ret = -1;
+ GB_ARGCHECK_OR_RETURN(argcount, 3, "list", GB_LIST_HELP_STR);
cobj.json_resp = json;
- if (argcount != 3) {
- MSG("%s\n", "Insufficient arguments for list:");
- MSG("%s\n", GB_LIST_HELP_STR);
- return -1;
- }
strcpy(cobj.volume, options[2]);
@@ -461,13 +464,8 @@ glusterBlockDelete(int argcount, char **options, int json)
int ret = -1;
+ GB_ARGCHECK_OR_RETURN(argcount, 3, "delete", GB_DELETE_HELP_STR);
cobj.json_resp = json;
- if (argcount != 3) {
- MSG("%s\n", "Insufficient arguments for delete:");
- MSG("%s\n", GB_DELETE_HELP_STR);
- return -1;
- }
-
if (glusterBlockParseVolumeBlock (options[2], cobj.volume,
cobj.block_name, GB_DELETE_HELP_STR,
@@ -500,13 +498,8 @@ glusterBlockInfo(int argcount, char **options, int json)
int ret = -1;
+ GB_ARGCHECK_OR_RETURN(argcount, 3, "info", GB_INFO_HELP_STR);
cobj.json_resp = json;
- if (argcount != 3) {
- MSG("%s\n", "Insufficient arguments for info:");
- MSG("%s\n", GB_INFO_HELP_STR);
- return -1;
- }
-
if (glusterBlockParseVolumeBlock (options[2], cobj.volume,
cobj.block_name, GB_INFO_HELP_STR,