cli/geo-rep: Fix geo-rep status detail

Earlier this command works when master and slave volume args are
given. Now it works even when no volume args are given (i.e. 'gluster
volume geo-replication status detail) and also when master volume is given
(i.e.'gluster volume geo-replication <master-vol> status detail').

BUG: 1410071
Signed-off-by: SonaArora <sarora@redhat.com>
Change-Id: I1a39241a4a5d70c20b2326599b3cccd8f1f6dc78
Reviewed-on: http://review.gluster.org/16347
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Kotresh HR <khiremat@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kotresh HR <khiremat@redhat.com>
This commit is contained in:
SonaArora 2017-01-06 14:21:56 +05:30 committed by Jeff Darcy
parent 522640be47
commit 27c85d014b

View File

@ -2852,23 +2852,22 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
cmdi = slavei + 1;
if (slavei == 3)
masteri = 2;
} else if (i <= 3) {
if (!strcmp ((char *)words[wordcount-1], "detail")) {
/* For status detail it is mandatory to provide
* both master and slave */
ret = -1;
goto out;
} else if (i <= 4) {
if (strtail ("detail", (char *)words[wordcount-1])) {
cmdi = wordcount - 2;
if (i == 4)
masteri = 2;
} else {
/* no $s, can only be status cmd
* (with either a single $m before it or nothing)
* -- these conditions imply that i <= 3 after
* the iteration and that i is the successor of
* the (0 or 1 length) sequence of $m-s.
*/
cmdi = i;
if (i == 3)
masteri = 2;
}
/* no $s, can only be status cmd
* (with either a single $m before it or nothing)
* -- these conditions imply that i <= 3 after
* the iteration and that i is the successor of
* the (0 or 1 length) sequence of $m-s.
*/
cmdi = i;
if (i == 3)
masteri = 2;
} else
goto out;
@ -2933,15 +2932,12 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
if (ret)
goto out;
if (!strcmp ((char *)words[wordcount-1], "detail")) {
if (strcmp ((char *)words[wordcount-2], "status")) {
ret = -1;
goto out;
}
if (!slavei || !masteri) {
if (strtail ("detail", (char *)words[wordcount-1])) {
if (!strtail ("status", (char *)words[wordcount-2])) {
ret = -1;
goto out;
}
ret = dict_set_uint32 (dict, "status-detail", _gf_true);
if (ret)
goto out;