diff options
author | Amar Tumballi <amar@gluster.com> | 2011-06-16 23:42:53 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-06-23 21:30:59 -0700 |
commit | 89452c4db44966bb80601c73c3b835d002af9fd5 (patch) | |
tree | b5cd35165617489ad545d5f26ac57bf6093e8355 /xlators/mgmt/glusterd/src/glusterd-store.c | |
parent | c9854677fcd5a0a68e885cc18b6d9d6d92218f23 (diff) |
gluster volume info: fix the output of 'stripe-replicated' volumes
also fix the glusterd-store to preserve the required information
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 3040 (need a way to create volumes with 'stripe+replicate' setup..)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3040
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 095385c7c7b..110d459dca3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -591,6 +591,12 @@ glusterd_volume_exclude_options_write (int fd, glusterd_volinfo_t *volinfo) if (ret) goto out; + snprintf (buf, sizeof (buf), "%d", volinfo->stripe_count); + ret = glusterd_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_STRIPE_CNT, + buf); + if (ret) + goto out; + snprintf (buf, sizeof (buf), "%d", volinfo->version); ret = glusterd_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_VERSION, buf); @@ -1555,6 +1561,9 @@ glusterd_store_retrieve_volume (char *volname) } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_SUB_COUNT, strlen (GLUSTERD_STORE_KEY_VOL_SUB_COUNT))) { volinfo->sub_count = atoi (value); + } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_STRIPE_CNT, + strlen (GLUSTERD_STORE_KEY_VOL_STRIPE_CNT))) { + volinfo->stripe_count = atoi (value); } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_TRANSPORT, strlen (GLUSTERD_STORE_KEY_VOL_TRANSPORT))) { volinfo->transport_type = atoi (value); @@ -1613,6 +1622,10 @@ glusterd_store_retrieve_volume (char *volname) if (op_errno != GD_STORE_EOF) goto out; + if (volinfo->stripe_count) + volinfo->replica_count = (volinfo->sub_count / + volinfo->stripe_count); + ret = glusterd_store_iter_destroy (iter); if (ret) |