diff options
author | Aravinda VK <avishwan@redhat.com> | 2015-03-12 16:07:13 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-05-05 02:15:24 -0700 |
commit | 98b69412e92742e0638ef8bd76223671386f5a39 (patch) | |
tree | 4d02c8989c50c7b219404900bc7beac327b19dca /cli | |
parent | e02ac3c28241ff004d6cfbfc03975822146ce5dd (diff) |
geo-rep: Status Enhancements
Discussion in gluster-devel
http://www.gluster.org/pipermail/gluster-devel/2015-April/044301.html
MASTER NODE - Master Volume Node
MASTER VOL - Master Volume name
MASTER BRICK - Master Volume Brick
SLAVE USER - Slave User to which Geo-rep session is established
SLAVE - <SLAVE_NODE>::<SLAVE_VOL> used in Geo-rep Create command
SLAVE NODE - Slave Node to which Master worker is connected
STATUS - Worker Status(Created, Initializing, Active, Passive, Faulty,
Paused, Stopped)
CRAWL STATUS - Crawl type(Hybrid Crawl, History Crawl, Changelog Crawl)
LAST_SYNCED - Last Synced Time(Local Time in CLI output and UTC in XML output)
ENTRY - Number of entry Operations pending.(Resets on worker restart)
DATA - Number of Data operations pending(Resets on worker restart)
META - Number of Meta operations pending(Resets on worker restart)
FAILURES - Number of Failures
CHECKPOINT TIME - Checkpoint set Time(Local Time in CLI output and UTC
in XML output)
CHECKPOINT COMPLETED - Yes/No or N/A
CHECKPOINT COMPLETION TIME - Checkpoint Completed Time(Local Time in CLI
output and UTC in XML output)
XML output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
cliOutput>
geoRep>
volume>
name>
sessions>
session>
session_slave>
pair>
master_node>
master_brick>
slave_user>
slave/>
slave_node>
status>
crawl_status>
entry>
data>
meta>
failures>
checkpoint_completed>
master_node_uuid>
last_synced>
checkpoint_time>
checkpoint_completion_time>
BUG: 1212410
Change-Id: I944a6c3c67f1e6d6baf9670b474233bec8f61ea3
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/10121
Tested-by: NetBSD Build System
Reviewed-by: Kotresh HR <khiremat@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 4 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 80 | ||||
-rw-r--r-- | cli/src/cli-xml-output.c | 68 | ||||
-rw-r--r-- | cli/src/cli.h | 3 |
4 files changed, 89 insertions, 66 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 65ccfcdcc5f..d70f6ee1e30 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -2274,8 +2274,8 @@ config_parse (const char **words, int wordcount, dict_t *dict, ret = -1; goto out; } - snprintf (append_str, 300, "now:%" GF_PRI_SECOND ".%06"GF_PRI_SUSECONDS, - tv.tv_sec, tv.tv_usec); + snprintf (append_str, 300, "%" GF_PRI_SECOND, + tv.tv_sec); } ret = dict_set_dynstr (dict, "op_value", append_str); diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 091608d8881..49c8761bbab 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -4406,18 +4406,24 @@ get_struct_variable (int mem_num, gf_gsync_status_t *sts_val) case 1: return (sts_val->master); case 2: return (sts_val->brick); case 3: return (sts_val->slave_user); - case 4: return (sts_val->slave_node); - case 5: return (sts_val->worker_status); - case 6: return (sts_val->checkpoint_status); + case 4: return (sts_val->slave); + case 5: return (sts_val->slave_node); + case 6: return (sts_val->worker_status); case 7: return (sts_val->crawl_status); - case 8: return (sts_val->files_syncd); - case 9: return (sts_val->files_remaining); - case 10: return (sts_val->bytes_remaining); - case 11: return (sts_val->purges_remaining); - case 12: return (sts_val->total_files_skipped); - case 13: return (sts_val->brick_host_uuid); - case 14: return (sts_val->slavekey); - case 15: return (sts_val->session_slave); + case 8: return (sts_val->last_synced); + case 9: return (sts_val->entry); + case 10: return (sts_val->data); + case 11: return (sts_val->meta); + case 12: return (sts_val->failures); + case 13: return (sts_val->checkpoint_time); + case 14: return (sts_val->checkpoint_completed); + case 15: return (sts_val->checkpoint_completion_time); + case 16: return (sts_val->brick_host_uuid); + case 17: return (sts_val->last_synced_utc); + case 18: return (sts_val->checkpoint_time_utc); + case 19: return (sts_val->checkpoint_completion_time_utc); + case 20: return (sts_val->slavekey); + case 21: return (sts_val->session_slave); default: goto out; } @@ -4435,7 +4441,7 @@ gf_cli_print_status (char **title_values, int i = 0; int j = 0; int ret = 0; - int status_fields = 7; /* Indexed at 0 */ + int status_fields = 8; /* Indexed at 0 */ int total_spacing = 0; char **output_values = NULL; char *tmp = NULL; @@ -4494,13 +4500,15 @@ gf_cli_print_status (char **title_values, strlen(title_values[j])); output_values[j][spacing[j]] = '\0'; } - cli_out ("%s %s %s %s %s %s %s %s %s %s %s %s", + cli_out ("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s", output_values[0], output_values[1], output_values[2], output_values[3], output_values[4], output_values[5], output_values[6], output_values[7], output_values[8], output_values[9], - output_values[10], output_values[11]); + output_values[10], output_values[11], + output_values[12], output_values[13], + output_values[14], output_values[15]); /* setting and printing the hyphens */ memset (hyphens, '-', total_spacing); @@ -4527,13 +4535,15 @@ gf_cli_print_status (char **title_values, output_values[j][spacing[j]] = '\0'; } - cli_out ("%s %s %s %s %s %s %s %s %s %s %s %s", + cli_out ("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s", output_values[0], output_values[1], output_values[2], output_values[3], output_values[4], output_values[5], output_values[6], output_values[7], output_values[8], output_values[9], - output_values[10], output_values[11]); + output_values[10], output_values[11], + output_values[12], output_values[13], + output_values[14], output_values[15]); } out: @@ -4552,6 +4562,23 @@ out: } int +gf_gsync_status_t_comparator (const void *p, const void *q) +{ + char *slavekey1 = NULL; + char *slavekey2 = NULL; + + slavekey1 = get_struct_variable (20, (*(gf_gsync_status_t **)p)); + slavekey2 = get_struct_variable (20, (*(gf_gsync_status_t **)q)); + if (!slavekey1 || !slavekey2) { + gf_log ("cli", GF_LOG_ERROR, + "struct member empty."); + return 0; + } + + return strcmp (slavekey1, slavekey2); +} + +int gf_cli_read_status_data (dict_t *dict, gf_gsync_status_t **sts_vals, int *spacing, int gsync_count, @@ -4586,6 +4613,11 @@ gf_cli_read_status_data (dict_t *dict, } } + /* Sort based on Session Slave */ + qsort(sts_vals, gsync_count, + sizeof(gf_gsync_status_t *), + gf_gsync_status_t_comparator); + out: return ret; } @@ -4596,18 +4628,20 @@ gf_cli_gsync_status_output (dict_t *dict, gf_boolean_t is_detail) int gsync_count = 0; int i = 0; int ret = 0; - int spacing[13] = {0}; - int num_of_fields = 13; + int spacing[16] = {0}; + int num_of_fields = 16; char errmsg[1024] = ""; char *master = NULL; char *slave = NULL; char *title_values[] = {"MASTER NODE", "MASTER VOL", "MASTER BRICK", "SLAVE USER", - "SLAVE", - "STATUS", "CHECKPOINT STATUS", - "CRAWL STATUS", "FILES SYNCD", - "FILES PENDING", "BYTES PENDING", - "DELETES PENDING", "FILES SKIPPED"}; + "SLAVE", "SLAVE NODE", + "STATUS", "CRAWL STATUS", + "LAST_SYNCED", "ENTRY", + "DATA", "META", "FAILURES", + "CHECKPOINT TIME", + "CHECKPOINT COMPLETED", + "CHECKPOINT COMPLETION TIME"}; gf_gsync_status_t **sts_vals = NULL; /* Checks if any session is active or not */ diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index cbb4c1f58e7..d7322d5bb0d 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -3839,25 +3839,6 @@ out: #if (HAVE_LIB_XML) int -gf_gsync_status_t_comparator (const void *p, const void *q) -{ - char *master1 = NULL; - char *master2 = NULL; - - master1 = get_struct_variable (1, (*(gf_gsync_status_t **)p)); - master2 = get_struct_variable (1, (*(gf_gsync_status_t **)q)); - if (!master1 || !master2) { - gf_log ("cli", GF_LOG_ERROR, - "struct member empty."); - return 0; - } - - return strcmp (master1,master2); -} -#endif - -#if (HAVE_LIB_XML) -int cli_xml_output_vol_gsync_status (dict_t *dict, xmlTextWriterPtr writer) { @@ -3865,8 +3846,7 @@ cli_xml_output_vol_gsync_status (dict_t *dict, int i = 1; int j = 0; int count = 0; - const int number_of_fields = 13; - const int number_of_basic_fields = 8; + const int number_of_fields = 20; int closed = 1; int session_closed = 1; gf_gsync_status_t **status_values = NULL; @@ -3878,18 +3858,31 @@ cli_xml_output_vol_gsync_status (dict_t *dict, char *slave = NULL; char *slave_next = NULL; char *title_values[] = {"master_node", - "master_node_uuid", + "", "master_brick", "slave_user", "slave", + "slave_node", "status", - "checkpoint_status", "crawl_status", - "files_syncd", - "files_pending", - "bytes_pending", - "deletes_pending", - "files_skipped"}; + /* last_synced */ + "", + "entry", + "data", + "meta", + "failures", + /* checkpoint_time */ + "", + "checkpoint_completed", + /* checkpoint_completion_time */ + "", + "master_node_uuid", + /* last_synced_utc */ + "last_synced", + /* checkpoint_time_utc */ + "checkpoint_time", + /* checkpoint_completion_time_utc */ + "checkpoint_completion_time"}; GF_ASSERT (dict); @@ -3963,7 +3956,7 @@ cli_xml_output_vol_gsync_status (dict_t *dict, session_closed = 0; - tmp = get_struct_variable (15, status_values[i]); + tmp = get_struct_variable (21, status_values[i]); if (!tmp) { gf_log ("cli", GF_LOG_ERROR, "struct member empty."); @@ -3980,18 +3973,11 @@ cli_xml_output_vol_gsync_status (dict_t *dict, XML_RET_CHECK_AND_GOTO (ret, out); for (j = 0; j < number_of_fields; j++) { - // if detail option is not set and field is not under - // basic fields or if field is volume then skip - if(!status_detail && j >= number_of_basic_fields) + /* XML ignore fields */ + if (strcmp(title_values[j], "") == 0) continue; - // Displaying the master_node uuid as second field - - if (j == 1) - tmp = get_struct_variable (13, - status_values[i]); - else - tmp = get_struct_variable (j, status_values[i]); + tmp = get_struct_variable (j, status_values[i]); if (!tmp) { gf_log ("cli", GF_LOG_ERROR, "struct member empty."); @@ -4009,8 +3995,8 @@ cli_xml_output_vol_gsync_status (dict_t *dict, XML_RET_CHECK_AND_GOTO (ret, out); if (i+1 < count) { - slave = get_struct_variable (14, status_values[i]); - slave_next = get_struct_variable (14, + slave = get_struct_variable (20, status_values[i]); + slave_next = get_struct_variable (20, status_values[i+1]); volume = get_struct_variable (1, status_values[i]); volume_next = get_struct_variable (1, diff --git a/cli/src/cli.h b/cli/src/cli.h index c0750f2dd74..243935230d1 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -449,4 +449,7 @@ print_quota_list_header (int type); void print_quota_list_empty (char *path, int type); +int +gf_gsync_status_t_comparator (const void *p, const void *q); + #endif /* __CLI_H__ */ |