diff options
author | Krishnan Parthasarathi <kp@gluster.com> | 2011-10-03 15:25:12 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-10-05 22:21:19 -0700 |
commit | e397772955f10f22fcb920f34a32efd859fb727d (patch) | |
tree | e7f805788dcfca193b3d36c60e057b25338387df /xlators/mgmt | |
parent | 72f80b87c40a899a5c6f838d368a80e6f9846f69 (diff) |
glusterd: Handle restoring of volumes created in older versions.
Change-Id: Idd9cb9d05122750ac78410b8f5a080104d6c1e0a
BUG: 3685
Reviewed-on: http://review.gluster.com/554
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index a18deceafb6..823fb37cd71 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -1895,21 +1895,34 @@ glusterd_store_retrieve_volume (char *volname) /* backward compatibility */ { - /* would be true if type is 'GF_CLUSTER_TYPE_NONE' */ - if (!volinfo->dist_leaf_count) - volinfo->dist_leaf_count = ((!volinfo->sub_count) ? 1 : - volinfo->sub_count); - - /* would be true for all volumes in 3.1.x and 3.2.x, - or if type is not 'STRIPE_REPLICATE' (in 3.3 pre-releases) */ - if (!volinfo->stripe_count) - volinfo->stripe_count = 1; - - /* would be true for some pre-releases of 3.3, and all - releases of 3.1.x and 3.2.x */ - if (!volinfo->replica_count) - volinfo->replica_count = (volinfo->dist_leaf_count / - volinfo->stripe_count); + + switch (volinfo->type) { + + case GF_CLUSTER_TYPE_NONE: + volinfo->stripe_count = 1; + volinfo->replica_count = 1; + break; + + case GF_CLUSTER_TYPE_STRIPE: + volinfo->stripe_count = volinfo->sub_count; + volinfo->replica_count = 1; + break; + + case GF_CLUSTER_TYPE_REPLICATE: + volinfo->stripe_count = 1; + volinfo->replica_count = volinfo->sub_count; + break; + + case GF_CLUSTER_TYPE_STRIPE_REPLICATE: + /* Introduced in 3.3 */ + GF_ASSERT (volinfo->stripe_count > 0); + GF_ASSERT (volinfo->replica_count > 0); + break; + + default: + GF_ASSERT (0); + break; + } volinfo->dist_leaf_count = (volinfo->stripe_count * volinfo->replica_count); |