diff options
author | Avra Sengupta <asengupt@redhat.com> | 2015-07-05 12:21:31 +0530 |
---|---|---|
committer | Rajesh Joseph <rjoseph@redhat.com> | 2015-07-06 22:52:44 -0700 |
commit | cd43a3e15ee2d0f551740bf8d15a45f1d1f17e96 (patch) | |
tree | 800907bd3ddbdfbd0badb84f183f61894b73d8ef /xlators/mgmt/glusterd | |
parent | 87f512655f76e788a5a81c5de66ed55881cb5f82 (diff) |
glusterd/shared_storage: Use /var/lib/glusterd/ss_brick as shared storage's brick
The brick path we use to create shared storage is
/var/run/gluster/ss_brick.
The problem with using this brick path is /var/run/gluster
is a tmpfs and all the brick/shared storage data will be wiped
off when the node restarts. Hence using /var/lib/glusterd/ss_brick
as the brick path for shared storage volume as this brick and
the shared storage volume is internally created by us (albeit on
user's request), and contains only internal state data and no user data.
Change-Id: I808d1aa3e204a5d2022086d23bdbfdd44a2cfb1c
BUG: 1218573
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/11533
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 9 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 10 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 8 |
3 files changed, 11 insertions, 16 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 0a0c6ef0b67..07a407bd2bb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -51,7 +51,6 @@ #include <signal.h> #include <sys/wait.h> -extern char ss_brick_path[PATH_MAX]; extern char local_node_hostname[PATH_MAX]; static int glusterd_set_shared_storage (dict_t *dict, char *key, char *value, @@ -2291,12 +2290,12 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value, /* Re-create the brick path so as to be * * able to re-use it * */ - ret = recursive_rmdir (ss_brick_path); + ret = recursive_rmdir (GLUSTER_SHARED_STORAGE_BRICK_DIR); if (ret) { snprintf (errstr, PATH_MAX, "Failed to remove shared " "storage brick(%s). " - "Reason: %s", ss_brick_path, + "Reason: %s", GLUSTER_SHARED_STORAGE_BRICK_DIR, strerror (errno)); gf_msg (this->name, GF_LOG_ERROR, errno, GD_MSG_DIR_OP_FAILED, "%s", errstr); @@ -2304,12 +2303,12 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value, goto out; } - ret = mkdir_p (ss_brick_path, 0777, _gf_true); + ret = mkdir_p (GLUSTER_SHARED_STORAGE_BRICK_DIR, 0777, _gf_true); if (-1 == ret) { snprintf (errstr, PATH_MAX, "Failed to create shared " "storage brick(%s). " - "Reason: %s", ss_brick_path, + "Reason: %s", GLUSTER_SHARED_STORAGE_BRICK_DIR, strerror (errno)); gf_msg (this->name, GF_LOG_ERROR, errno, GD_MSG_CREATE_DIR_FAILED, "%s", errstr); diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index bdd141d24ae..1c4c613027d 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -64,7 +64,6 @@ extern struct rpc_clnt_program gd_brick_prog; extern struct rpcsvc_program glusterd_mgmt_hndsk_prog; extern char snap_mount_dir[PATH_MAX]; -char ss_brick_path[PATH_MAX]; rpcsvc_cbk_program_t glusterd_cbk_prog = { .progname = "Gluster Callback", @@ -1441,18 +1440,15 @@ init (xlator_t *this) snprintf (snap_mount_dir, sizeof(snap_mount_dir), "%s%s", var_run_dir, GLUSTERD_DEFAULT_SNAPS_BRICK_DIR); - ret = glusterd_init_var_run_dirs (this, var_run_dir, - GLUSTER_SHARED_STORAGE_BRICK_DIR); + ret = mkdir_p (GLUSTER_SHARED_STORAGE_BRICK_DIR, 0777, + _gf_true); if (ret) { gf_msg (this->name, GF_LOG_CRITICAL, 0, - GD_MSG_VAR_RUN_DIR_INIT_FAIL, "Unable to create " + GD_MSG_DIR_OP_FAILED, "Unable to create " "shared storage brick"); exit (1); } - snprintf (ss_brick_path, sizeof(ss_brick_path), "%s%s", - var_run_dir, GLUSTER_SHARED_STORAGE_BRICK_DIR); - snprintf (cmd_log_filename, PATH_MAX, "%s/cmd_history.log", DEFAULT_LOG_FILE_DIRECTORY); ret = gf_cmd_log_init (cmd_log_filename); diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index 0021efb4509..ec7c79c7c55 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -508,10 +508,10 @@ typedef enum { #define GLUSTERD_MISSED_SNAPS_LIST_FILE "missed_snaps_list" #define GLUSTERD_VOL_SNAP_DIR_PREFIX "snaps" -#define GLUSTERD_DEFAULT_SNAPS_BRICK_DIR "/gluster/snaps" -#define GLUSTER_SHARED_STORAGE_BRICK_DIR "/gluster/ss_brick" -#define GLUSTERD_VAR_RUN_DIR "/var/run" -#define GLUSTERD_RUN_DIR "/run" +#define GLUSTERD_DEFAULT_SNAPS_BRICK_DIR "/gluster/snaps" +#define GLUSTER_SHARED_STORAGE_BRICK_DIR GLUSTERD_DEFAULT_WORKDIR"/ss_brick" +#define GLUSTERD_VAR_RUN_DIR "/var/run" +#define GLUSTERD_RUN_DIR "/run" /* definitions related to replace brick */ #define RB_CLIENT_MOUNTPOINT "rb_mount" |