summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2010-10-01 09:23:40 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-01 09:33:54 -0700
commitb656bff2dd912bcd5caf5bf9303bdef17f753ce1 (patch)
tree7a7b4b56ca892205bd4be64f42a19caf34f411ab
parent24ec0fbc4bd145b93b80afa480d5cb4cf785717e (diff)
changes for replace-brick status message
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1767 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1767
-rw-r--r--xlators/cluster/afr/src/pump.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
index b10a7c0ae62..aaa9ca10e78 100644
--- a/xlators/cluster/afr/src/pump.c
+++ b/xlators/cluster/afr/src/pump.c
@@ -913,6 +913,9 @@ pump_execute_status (call_frame_t *frame, xlator_t *this)
{
afr_private_t *priv = NULL;
pump_private_t *pump_priv = NULL;
+ pump_state_t state;
+ char pump_status[1024] = {0,};
+ char current_file[1024] = {0,};
uint64_t number_files = 0;
@@ -928,6 +931,25 @@ pump_execute_status (call_frame_t *frame, xlator_t *this)
priv = this->private;
pump_priv = priv->pump_private;
+ state = pump_get_state ();
+ switch (state) {
+ case PUMP_STATE_RUNNING:
+ snprintf (pump_status, 1024, "PUMP_STATE_RUNNING");
+ break;
+ case PUMP_STATE_RESUME:
+ snprintf (pump_status, 1024, "PUMP_STATE_RESUME");
+ break;
+ case PUMP_STATE_PAUSE:
+ snprintf (pump_status, 1024, "PUMP_STATE_PAUSE");
+ break;
+ case PUMP_STATE_ABORT:
+ snprintf (pump_status, 1024, "PUMP_STATE_ABORT");
+ break;
+ default:
+ snprintf (pump_status, 1024, "Unknown pump state");
+ break;
+ }
+
LOCK (&pump_priv->resume_path_lock);
{
number_files = pump_priv->number_files_pumped;
@@ -945,11 +967,14 @@ pump_execute_status (call_frame_t *frame, xlator_t *this)
}
if (pump_priv->pump_finished) {
- snprintf (dict_str, PATH_MAX + 256, "Number of files migrated = %"PRIu64" Migration complete ",
- number_files);
+ snprintf (pump_status, 1024, "Migration complete");
+ snprintf (dict_str, PATH_MAX + 1024, "Status: %s \nNumber: Number of files migrated = %"PRIu64"\n",
+ pump_status, number_files);
} else {
- snprintf (dict_str, PATH_MAX + 256, "Number of files migrated = %"PRIu64" Current file= %s ",
- number_files, filename);
+ snprintf (current_file, 1024, "Curent file: %s", filename);
+ snprintf (dict_str, PATH_MAX + 1024 + 1024, "Status: %s \nNumber: Number of files migrated = %"PRIu64"\n"
+ "Current file: %s\n", pump_status,
+ number_files, filename);
}
dict = dict_new ();