summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2015-01-07 21:56:58 +0530
committerVijay Bellur <vbellur@redhat.com>2015-02-02 12:19:07 -0800
commit52765ad94f233e4b4e57515e49f5b7c9e7c08b43 (patch)
treebadad9a91e6a45e54205d3bc7941c305bf903c5a /xlators/mgmt
parent63f17d66258bca46532fe649bbb76a5e5948f22b (diff)
geo-rep: Adding Slave user field to georep status
New column introduced in Status output, "SLAVE USER", Slave user is not "root" in non root Geo-replication setup. Added additional tag in XML output <slave_user> BUG: 1180459 Change-Id: Ia48a5a8eb892ce883b9ec114be7bb2d46eff8535 Signed-off-by: Aravinda VK <avishwan@redhat.com> Reviewed-on: http://review.gluster.org/9409 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kotresh HR <khiremat@redhat.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Tested-by: Venky Shankar <vshankar@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index f75f7261ca1..c53f027def1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -3487,6 +3487,10 @@ glusterd_read_status_file (glusterd_volinfo_t *volinfo, char *slave,
dict_t *confd = NULL;
char *slavekey = NULL;
char *slaveentry = NULL;
+ char *slaveuser = NULL;
+ char *saveptr = NULL;
+ char *temp = NULL;
+ char *temp_inp = NULL;
char *brick_host_uuid = NULL;
int brick_host_uuid_length = 0;
int gsync_count = 0;
@@ -3718,10 +3722,27 @@ store_status:
GF_FREE (sts_val);
goto out;
}
+
+
memcpy (sts_val->session_slave, slaveentry,
strlen(slaveentry));
sts_val->session_slave[strlen(slaveentry)] = '\0';
+ temp_inp = gf_strdup(slaveentry);
+ if (!temp_inp)
+ goto out;
+
+ if (strstr(temp_inp, "@") == NULL) {
+ slaveuser = "root";
+ } else {
+ temp = strtok_r(temp_inp, "//", &saveptr);
+ temp = strtok_r(NULL, "/", &saveptr);
+ slaveuser = strtok_r(temp, "@", &saveptr);
+ }
+ memcpy (sts_val->slave_user, slaveuser,
+ strlen(slaveuser));
+ sts_val->slave_user[strlen(slaveuser)] = '\0';
+
snprintf (sts_val_name, sizeof (sts_val_name), "status_value%d", gsync_count);
ret = dict_set_bin (dict, sts_val_name, sts_val, sizeof(gf_gsync_status_t));
if (ret) {
@@ -3738,6 +3759,7 @@ store_status:
goto out;
out:
+ GF_FREE (temp_inp);
dict_unref (confd);
return 0;