diff options
author | Vijay Bellur <vijay@gluster.com> | 2010-08-31 00:59:47 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-08-30 23:37:18 -0700 |
commit | a29aec5fb2c6f6dd1d8e24049c282353c7f5db0f (patch) | |
tree | a3b0ff08320f12f36d78947c499f32647b558423 /xlators | |
parent | 507ee7301f2372a20c28897d60e1ec753539d886 (diff) |
mgmt/glusterd: Update store on start/stop volume
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1480 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1480
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 12 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 9 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 2 |
3 files changed, 17 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 6dcd6131fd8..8db3e37869a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2058,6 +2058,12 @@ glusterd_op_start_volume (gd1_mgmt_stage_op_req *req) glusterd_set_volume_status (volinfo, GLUSTERD_STATUS_STARTED); + ret = glusterd_store_update_volume (volinfo); + if (ret) + goto out; + + ret = glusterd_volume_compute_cksum (volinfo); + out: return ret; } @@ -2111,6 +2117,12 @@ glusterd_op_stop_volume (gd1_mgmt_stage_op_req *req) glusterd_set_volume_status (volinfo, GLUSTERD_STATUS_STOPPED); + ret = glusterd_store_update_volume (volinfo); + if (ret) + goto out; + + ret = glusterd_volume_compute_cksum (volinfo); + out: if (flags & GF_CLI_FLAG_OP_FORCE) ret = 0; diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index ee47696da96..22bb1a611c1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -1031,18 +1031,17 @@ glusterd_store_update_volume (glusterd_volinfo_t *volinfo) if (ret) goto out; - snprintf (buf, sizeof (buf), "%d", volinfo->port); + snprintf (buf, sizeof (buf), "%d", volinfo->sub_count); ret = glusterd_store_save_value (volinfo->shandle, - GLUSTERD_STORE_KEY_VOL_PORT, buf); + GLUSTERD_STORE_KEY_VOL_SUB_COUNT, buf); if (ret) goto out; - snprintf (buf, sizeof (buf), "%d", volinfo->sub_count); + snprintf (buf, sizeof (buf), "%d", volinfo->status); ret = glusterd_store_save_value (volinfo->shandle, - GLUSTERD_STORE_KEY_VOL_SUB_COUNT, buf); + GLUSTERD_STORE_KEY_VOL_VERSION, buf); if (ret) goto out; - list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { ret = glusterd_store_create_brick (volinfo, brickinfo); if (ret) diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 0d1d7bf64e8..024f5e5fa1f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -989,7 +989,7 @@ glusterd_volume_compute_cksum (glusterd_volinfo_t *volinfo) snprintf (cksum_path, sizeof (cksum_path), "%s/%s", path, GLUSTERD_CKSUM_FILE); - fd = open (cksum_path, O_RDWR | O_APPEND | O_CREAT, 0644); + fd = open (cksum_path, O_RDWR | O_APPEND | O_CREAT| O_TRUNC, 0644); if (-1 == fd) { gf_log ("", GF_LOG_ERROR, "Unable to open %s, errno: %d", |