diff options
author | Amar Tumballi <amar@gluster.com> | 2011-06-21 04:56:41 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-06-23 21:30:53 -0700 |
commit | c9854677fcd5a0a68e885cc18b6d9d6d92218f23 (patch) | |
tree | 3f54e891e90f05f9e5f7758da355522adfadaf65 /xlators/mgmt/glusterd/src | |
parent | 0d87bfca5c9a95977215599d5800e751ec8f2205 (diff) |
gluster volume create: option for stripe + replicate volume
So RAID01 like option is a possibility
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')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 11 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 41 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 2 |
3 files changed, 52 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 0cf94171c89..47f2c73c9eb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2707,6 +2707,17 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) &sub_count); if (ret) goto out; + } else if (GF_CLUSTER_TYPE_STRIPE_REPLICATE == volinfo->type) { + ret = dict_get_int32 (dict, "stripe-count", + &volinfo->stripe_count); + if (ret) + goto out; + ret = dict_get_int32 (dict, "replica-count", + &volinfo->replica_count); + if (ret) + goto out; + + sub_count = volinfo->stripe_count * volinfo->replica_count; } ret = dict_get_str (dict, "transport", &trans_type); diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index a090f46debd..607fe1dafae 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1506,6 +1506,7 @@ static int client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, dict_t *set_dict, void *param) { + int sub_count = 0; int dist_count = 0; char transt[16] = {0,}; char *volname = NULL; @@ -1576,7 +1577,8 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, return -1; } - if (volinfo->sub_count > 1) { + sub_count = volinfo->sub_count; + if (sub_count > 1) { switch (volinfo->type) { case GF_CLUSTER_TYPE_REPLICATE: cluster_args = replicate_args; @@ -1584,6 +1586,11 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, case GF_CLUSTER_TYPE_STRIPE: cluster_args = stripe_args; break; + case GF_CLUSTER_TYPE_STRIPE_REPLICATE: + /* Replicate after the clients, then stripe */ + sub_count = volinfo->replica_count; + cluster_args = replicate_args; + break; default: gf_log ("", GF_LOG_ERROR, "volume inconsistency: " "unrecognized clustering type"); @@ -1595,7 +1602,7 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, txl = first_of (graph); for (trav = txl; trav->next; trav = trav->next); for (;; trav = trav->prev) { - if (i % volinfo->sub_count == 0) { + if (i % sub_count == 0) { xl = volgen_graph_add_nolink (graph, cluster_args[0], cluster_args[1], @@ -1613,8 +1620,38 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, break; i++; } + + if (GF_CLUSTER_TYPE_STRIPE_REPLICATE == volinfo->type) { + sub_count = volinfo->stripe_count; + cluster_args = stripe_args; + + i = 0; + txl = first_of (graph); + for (trav = txl; --j; trav = trav->next); + for (;; trav = trav->prev) { + if (i % sub_count == 0) { + xl = volgen_graph_add_nolink (graph, + cluster_args[0], + cluster_args[1], + volname, j); + if (!xl) + return -1; + j++; + } + + ret = volgen_xlator_link (xl, trav); + if (ret) + return -1; + + if (trav == txl) + break; + i++; + } + + } } + if (volinfo->sub_count) dist_count = volinfo->brick_count / volinfo->sub_count; else diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index b1027c1714c..7cbb4bc56b6 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -187,6 +187,8 @@ struct glusterd_volinfo_ { struct list_head bricks; glusterd_volume_status status; int sub_count; + int stripe_count; + int replica_count; int port; glusterd_store_handle_t *shandle; |