summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorndarshan <dnarayan@redhat.com>2014-07-22 14:19:19 +0530
committerVijay Bellur <vbellur@redhat.com>2014-08-28 09:52:25 -0700
commit845d6c76701a3de6a11b76b004176971411c714e (patch)
tree778b8d81b523c70ba88d0c8fd88ab36c42f45ccd /xlators/mgmt
parenta6ec32fda6a6266071b8f9eaae9fdcd4cdbe860e (diff)
cli: Xml output for geo-replication status command
This patch adds xml output for geo-replication status and status detail command. sample: -------------------------------------------------------------- <geoRep> <volume> <name>master</name> <sessions> <session> <session_slave>:2a301d66-b9d2-44b4-b827-d680d67123eb:ssh://XXXXXXXXXX::slave</session_slave> <pair> <master_node>localhost.localdomain</master_node> <master_node_uuid>2a301d66-b9d2-44b4-b827-d680d67123eb</master_node_uuid> <master_brick>/root/master_b1</master_brick> <slave>ssh://XXXXXXXXXXX::slave</slave> <status>faulty</status> <checkpoint_status>N/A</checkpoint_status> <crawl_status>N/A</crawl_status> </pair> </session> </sessions> </volume> </geoRep> ------------------------------------------------------------- Change-Id: Ia19dbe751c3ab1ec7cb8923cdd6c8b99c374072f BUG: 1133464 Signed-off-by: ndarshan <dnarayan@redhat.com> Reviewed-on: http://review.gluster.org/8089 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com> Signed-off-by: ndarshan <dnarayan@redhat.com> Reviewed-on: http://review.gluster.org/8532 Reviewed-by: Sachin Pandit <spandit@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index def83fb2055..f4c5f1cb685 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -3471,6 +3471,10 @@ glusterd_read_status_file (glusterd_volinfo_t *volinfo, char *slave,
char *statefile = NULL;
char *socketfile = NULL;
dict_t *confd = NULL;
+ char *slavekey = NULL;
+ char *slaveentry = NULL;
+ char *brick_host_uuid = NULL;
+ int brick_host_uuid_length = 0;
int gsync_count = 0;
int i = 0;
int ret = 0;
@@ -3676,9 +3680,34 @@ store_status:
sts_val->node[strlen(node)] = '\0';
memcpy (sts_val->brick, brickinfo->path, strlen(brickinfo->path));
sts_val->brick[strlen(brickinfo->path)] = '\0';
+
+ ret = glusterd_get_slave (volinfo, slave, &slavekey);
+ if (ret < 0) {
+ GF_FREE (sts_val);
+ goto out;
+ }
+ memcpy (sts_val->slavekey, slavekey, strlen(slavekey));
+ sts_val->slavekey[strlen(slavekey)] = '\0';
+
+ brick_host_uuid = uuid_utoa(brickinfo->uuid);
+ brick_host_uuid_length = strlen (brick_host_uuid);
+ memcpy (sts_val->brick_host_uuid, brick_host_uuid,
+ brick_host_uuid_length);
+ sts_val->brick_host_uuid[brick_host_uuid_length] = '\0';
+
memcpy (sts_val->master, master, strlen(master));
sts_val->master[strlen(master)] = '\0';
+ ret = dict_get_str (volinfo->gsync_slaves, slavekey,
+ &slaveentry);
+ if (ret < 0) {
+ GF_FREE (sts_val);
+ goto out;
+ }
+ memcpy (sts_val->session_slave, slaveentry,
+ strlen(slaveentry));
+ sts_val->session_slave[strlen(slaveentry)] = '\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) {