summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2010-09-27 16:20:19 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-27 22:07:29 -0700
commitefd1f08b57a3175cab9bb543833bc3c9192b527d (patch)
treef7d763af8ac5c6eab2a62729e1fbf4daa7522671 /xlators/mgmt/glusterd/src/glusterd-volgen.c
parent4a9c36ea9df9dada0d16c5fdb9fe149b360d9150 (diff)
replace brick fixes
Reviewed ok. Just like commit, maybe we can move 'pause' also to the commit op of replace brick since it can be performed only when replace brick has been started. I'll send in a patch for that soon. ----- Original Message ----- From: "Vijay Bellur" <vijay@gluster.com> To: glusterfs@dev.gluster.com Sent: Monday, September 27, 2010 7:59:25 PM Subject: [PATCH BUG:1235] replace brick fixes Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1235 (Bug for all pump/migrate commits) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1235
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c91
1 files changed, 71 insertions, 20 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 75f728c63..782170c9a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -2255,38 +2255,24 @@ out:
static int
generate_brick_volfiles (glusterd_volinfo_t *volinfo)
{
- glusterd_brickinfo_t *brickinfo = NULL;
- char *filename = NULL;
- int ret = -1;
+ glusterd_brickinfo_t *brickinfo = NULL;
+ int ret = -1;
list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
gf_log ("", GF_LOG_DEBUG,
"Found a brick - %s:%s", brickinfo->hostname,
brickinfo->path);
- filename = get_brick_filename (volinfo, brickinfo);
- if (!filename) {
- gf_log ("", GF_LOG_ERROR,
- "Out of memory");
- ret = -1;
- goto out;
- }
-
- ret = generate_server_volfile (brickinfo, volinfo->dict,
- filename);
- if (ret) {
- gf_log ("", GF_LOG_DEBUG,
- "Could not generate volfile for brick %s:%s",
- brickinfo->hostname, brickinfo->path);
+ ret = glusterd_generate_brick_volfile (volinfo, brickinfo);
+ if (ret)
goto out;
- }
- if (filename)
- GF_FREE (filename);
}
ret = 0;
+
out:
+ gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
}
@@ -2539,6 +2525,34 @@ glusterd_volgen_set_transport (glusterd_volinfo_t *volinfo)
}
int
+glusterd_rb_create_volfiles (glusterd_volinfo_t *volinfo,
+ glusterd_brickinfo_t *brickinfo)
+{
+ int ret = -1;
+
+ glusterd_volgen_set_transport (volinfo);
+
+ ret = glusterd_generate_brick_volfile (volinfo, brickinfo);
+ if (ret) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Could not generate volfiles for bricks");
+ goto out;
+ }
+
+ ret = generate_client_volfiles (volinfo);
+ if (ret) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Could not generate volfile for client");
+ goto out;
+ }
+
+ ret = glusterd_fetchspec_notify (THIS);
+
+out:
+ return ret;
+}
+
+int
glusterd_create_volfiles (glusterd_volinfo_t *volinfo)
{
int ret = -1;
@@ -2583,3 +2597,40 @@ glusterd_delete_volfile (glusterd_volinfo_t *volinfo,
GF_FREE (filename);
return 0;
}
+
+int
+glusterd_generate_brick_volfile (glusterd_volinfo_t *volinfo,
+ glusterd_brickinfo_t *brickinfo)
+{
+ char *filename = NULL;
+ int ret = -1;
+
+ GF_ASSERT (volinfo);
+ GF_ASSERT (brickinfo);
+
+ filename = get_brick_filename (volinfo, brickinfo);
+
+ if (!filename) {
+ gf_log ("", GF_LOG_ERROR,
+ "Out of memory");
+ ret = -1;
+ goto out;
+ }
+
+ ret = generate_server_volfile (brickinfo, volinfo->dict,
+ filename);
+ if (ret) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Could not generate volfile for brick %s:%s",
+ brickinfo->hostname, brickinfo->path);
+ goto out;
+ }
+
+ ret = 0;
+
+out:
+ if (filename)
+ GF_FREE (filename);
+
+ return ret;
+}