diff options
author | Sakshi Bansal <sabansal@redhat.com> | 2016-06-29 12:09:06 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2016-07-15 02:02:03 -0700 |
commit | 84ddf400ee6f9db1b497ab466249a464ab62d534 (patch) | |
tree | b125638f9aa43cdcd1557e8b3f9dcff5b3152e88 /xlators/mgmt/glusterd | |
parent | 05dacf07b4d427aa144aacb730e2296d9f96fe6a (diff) |
glusterd: glusterd must store all rebalance related information
Backport of http://review.gluster.org/14827
> Change-Id: I8404b864a405411e3af2fbee46ca20330e656045
> BUG: 1351021
> Signed-off-by: Sakshi Bansal <sabansal@redhat.com>
> Reviewed-on: http://review.gluster.org/14827
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Change-Id: I8404b864a405411e3af2fbee46ca20330e656045
BUG: 1352771
Signed-off-by: Sakshi Bansal <sabansal@redhat.com>
Reviewed-on: http://review.gluster.org/14856
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 55 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.h | 7 |
2 files changed, 61 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index aa2be17bd9a..8b903ba1e48 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -1392,6 +1392,41 @@ glusterd_store_node_state_write (int fd, glusterd_volinfo_t *volinfo) if (ret) goto out; + snprintf (buf, sizeof (buf), "%"PRIu64, volinfo->rebal.rebalance_files); + ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_DEFRAG_REB_FILES, + buf); + if (ret) + goto out; + + snprintf (buf, sizeof (buf), "%"PRIu64, volinfo->rebal.rebalance_data); + ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_DEFRAG_SIZE, buf); + if (ret) + goto out; + + snprintf (buf, sizeof (buf), "%"PRIu64, volinfo->rebal.lookedup_files); + ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_DEFRAG_SCANNED, + buf); + if (ret) + goto out; + + snprintf (buf, sizeof (buf), "%"PRIu64, volinfo->rebal.rebalance_failures); + ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_DEFRAG_FAILURES, + buf); + if (ret) + goto out; + + snprintf (buf, sizeof (buf), "%"PRIu64, volinfo->rebal.skipped_files); + ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_DEFRAG_SKIPPED, + buf); + if (ret) + goto out; + + snprintf (buf, sizeof (buf), "%lf", volinfo->rebal.rebalance_time); + ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_DEFRAG_RUN_TIME, + buf); + if (ret) + goto out; + if (volinfo->rebal.dict) { dict_foreach (volinfo->rebal.dict, _gd_store_rebalance_dict, &fd); @@ -2503,8 +2538,26 @@ glusterd_store_retrieve_node_state (glusterd_volinfo_t *volinfo) strlen (GF_REBALANCE_TID_KEY))) { gf_uuid_parse (value, volinfo->rebal.rebalance_id); } else if (!strncmp (key, GLUSTERD_STORE_KEY_DEFRAG_OP, - strlen (GLUSTERD_STORE_KEY_DEFRAG_OP))) { + strlen (GLUSTERD_STORE_KEY_DEFRAG_OP))) { volinfo->rebal.op = atoi (value); + } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_DEFRAG_REB_FILES, + strlen (GLUSTERD_STORE_KEY_VOL_DEFRAG_REB_FILES))) { + volinfo->rebal.rebalance_files = atoi (value); + } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_DEFRAG_SIZE, + strlen (GLUSTERD_STORE_KEY_VOL_DEFRAG_SIZE))) { + volinfo->rebal.rebalance_data = atoi (value); + } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_DEFRAG_SCANNED, + strlen (GLUSTERD_STORE_KEY_VOL_DEFRAG_SCANNED))) { + volinfo->rebal.lookedup_files = atoi (value); + } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_DEFRAG_FAILURES, + strlen (GLUSTERD_STORE_KEY_VOL_DEFRAG_FAILURES))) { + volinfo->rebal.rebalance_failures = atoi (value); + } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_DEFRAG_SKIPPED, + strlen (GLUSTERD_STORE_KEY_VOL_DEFRAG_SKIPPED))) { + volinfo->rebal.skipped_files = atoi (value); + } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_DEFRAG_RUN_TIME, + strlen (GLUSTERD_STORE_KEY_VOL_DEFRAG_RUN_TIME))) { + volinfo->rebal.rebalance_time = atoi (value); } else { if (!tmp_dict) { tmp_dict = dict_new (); diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h index ec293b64e82..afb04cb5ec6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.h +++ b/xlators/mgmt/glusterd/src/glusterd-store.h @@ -103,6 +103,13 @@ typedef enum glusterd_store_ver_ac_{ #define GLUSTERD_STORE_KEY_VOL_CAPS "caps" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_REB_FILES "rebalanced-files" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_SIZE "size" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_SCANNED "scanned" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_FAILURES "failures" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_SKIPPED "skipped" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_RUN_TIME "run-time" + int32_t glusterd_store_volinfo (glusterd_volinfo_t *volinfo, glusterd_volinfo_ver_ac_t ac); |