|
|
cb8e9e |
From 0f3b3f4e3c24c391e8a9ed2a44e32c7499c50fa4 Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: Avra Sengupta <asengupt@redhat.com>
|
|
|
cb8e9e |
Date: Sun, 5 Jul 2015 12:21:31 +0530
|
|
|
cb8e9e |
Subject: [PATCH 204/212] glusterd/shared_storage: Use /var/lib/glusterd/ss_brick as shared storage's brick
|
|
|
cb8e9e |
|
|
|
cb8e9e |
The brick path we use to create shared storage is
|
|
|
cb8e9e |
/var/run/gluster/ss_brick.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
The problem with using this brick path is /var/run/gluster
|
|
|
cb8e9e |
is a tmpfs and all the brick/shared storage data will be wiped
|
|
|
cb8e9e |
off when the node restarts. Hence using /var/lib/glusterd/ss_brick
|
|
|
cb8e9e |
as the brick path for shared storage volume as this brick and
|
|
|
cb8e9e |
the shared storage volume is internally created by us (albeit on
|
|
|
cb8e9e |
user's request), and contains only internal state data and no user data.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
>Reviewed-on: http://review.gluster.org/11533
|
|
|
cb8e9e |
Change-Id: I808d1aa3e204a5d2022086d23bdbfdd44a2cfb1c
|
|
|
cb8e9e |
BUG: 1223205
|
|
|
cb8e9e |
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/52414
|
|
|
cb8e9e |
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
cb8e9e |
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
.../set/post/S32gluster_enable_shared_storage.sh | 2 +-
|
|
|
cb8e9e |
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 9 ++++-----
|
|
|
cb8e9e |
xlators/mgmt/glusterd/src/glusterd.c | 10 +++-------
|
|
|
cb8e9e |
xlators/mgmt/glusterd/src/glusterd.h | 8 ++++----
|
|
|
cb8e9e |
4 files changed, 12 insertions(+), 17 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh b/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh
|
|
|
cb8e9e |
index 68bc44d..9080219 100755
|
|
|
cb8e9e |
--- a/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh
|
|
|
cb8e9e |
+++ b/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh
|
|
|
cb8e9e |
@@ -74,7 +74,7 @@ create_cmd="gluster --mode=script --wignore volume create \
|
|
|
cb8e9e |
# Adding the brick names in the command
|
|
|
cb8e9e |
for i in "${connected_peer[@]}"
|
|
|
cb8e9e |
do
|
|
|
cb8e9e |
- create_cmd=$create_cmd" "$i:/var/run/gluster/ss_brick
|
|
|
cb8e9e |
+ create_cmd=$create_cmd" "$i:"$GLUSTERD_WORKDIR"/ss_brick
|
|
|
cb8e9e |
done
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if [ "$option" == "disable" ]; then
|
|
|
cb8e9e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
cb8e9e |
index c8acc86..4619f57 100644
|
|
|
cb8e9e |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
cb8e9e |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
cb8e9e |
@@ -56,7 +56,6 @@
|
|
|
cb8e9e |
#include <signal.h>
|
|
|
cb8e9e |
#include <sys/wait.h>
|
|
|
cb8e9e |
|
|
|
cb8e9e |
-extern char ss_brick_path[PATH_MAX];
|
|
|
cb8e9e |
extern char local_node_hostname[PATH_MAX];
|
|
|
cb8e9e |
static int
|
|
|
cb8e9e |
glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
|
|
|
cb8e9e |
@@ -2245,12 +2244,12 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
|
|
|
cb8e9e |
/* Re-create the brick path so as to be *
|
|
|
cb8e9e |
* able to re-use it *
|
|
|
cb8e9e |
*/
|
|
|
cb8e9e |
- ret = recursive_rmdir (ss_brick_path);
|
|
|
cb8e9e |
+ ret = recursive_rmdir (GLUSTER_SHARED_STORAGE_BRICK_DIR);
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
snprintf (errstr, PATH_MAX,
|
|
|
cb8e9e |
"Failed to remove shared "
|
|
|
cb8e9e |
"storage brick(%s). "
|
|
|
cb8e9e |
- "Reason: %s", ss_brick_path,
|
|
|
cb8e9e |
+ "Reason: %s", GLUSTER_SHARED_STORAGE_BRICK_DIR,
|
|
|
cb8e9e |
strerror (errno));
|
|
|
cb8e9e |
gf_msg (this->name, GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
GD_MSG_DIR_OP_FAILED, "%s", errstr);
|
|
|
cb8e9e |
@@ -2258,12 +2257,12 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- ret = mkdir_p (ss_brick_path, 0777, _gf_true);
|
|
|
cb8e9e |
+ ret = mkdir_p (GLUSTER_SHARED_STORAGE_BRICK_DIR, 0777, _gf_true);
|
|
|
cb8e9e |
if (-1 == ret) {
|
|
|
cb8e9e |
snprintf (errstr, PATH_MAX,
|
|
|
cb8e9e |
"Failed to create shared "
|
|
|
cb8e9e |
"storage brick(%s). "
|
|
|
cb8e9e |
- "Reason: %s", ss_brick_path,
|
|
|
cb8e9e |
+ "Reason: %s", GLUSTER_SHARED_STORAGE_BRICK_DIR,
|
|
|
cb8e9e |
strerror (errno));
|
|
|
cb8e9e |
gf_msg (this->name, GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
GD_MSG_CREATE_DIR_FAILED, "%s", errstr);
|
|
|
cb8e9e |
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
|
|
|
cb8e9e |
index 4203705..9754e8b 100644
|
|
|
cb8e9e |
--- a/xlators/mgmt/glusterd/src/glusterd.c
|
|
|
cb8e9e |
+++ b/xlators/mgmt/glusterd/src/glusterd.c
|
|
|
cb8e9e |
@@ -68,7 +68,6 @@ extern struct rpc_clnt_program gd_brick_prog;
|
|
|
cb8e9e |
extern struct rpcsvc_program glusterd_mgmt_hndsk_prog;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
extern char snap_mount_dir[PATH_MAX];
|
|
|
cb8e9e |
-char ss_brick_path[PATH_MAX];
|
|
|
cb8e9e |
|
|
|
cb8e9e |
rpcsvc_cbk_program_t glusterd_cbk_prog = {
|
|
|
cb8e9e |
.progname = "Gluster Callback",
|
|
|
cb8e9e |
@@ -1445,18 +1444,15 @@ init (xlator_t *this)
|
|
|
cb8e9e |
snprintf (snap_mount_dir, sizeof(snap_mount_dir), "%s%s",
|
|
|
cb8e9e |
var_run_dir, GLUSTERD_DEFAULT_SNAPS_BRICK_DIR);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- ret = glusterd_init_var_run_dirs (this, var_run_dir,
|
|
|
cb8e9e |
- GLUSTER_SHARED_STORAGE_BRICK_DIR);
|
|
|
cb8e9e |
+ ret = mkdir_p (GLUSTER_SHARED_STORAGE_BRICK_DIR, 0777,
|
|
|
cb8e9e |
+ _gf_true);
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
gf_msg (this->name, GF_LOG_CRITICAL, 0,
|
|
|
cb8e9e |
- GD_MSG_VAR_RUN_DIR_INIT_FAIL, "Unable to create "
|
|
|
cb8e9e |
+ GD_MSG_DIR_OP_FAILED, "Unable to create "
|
|
|
cb8e9e |
"shared storage brick");
|
|
|
cb8e9e |
exit (1);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- snprintf (ss_brick_path, sizeof(ss_brick_path), "%s%s",
|
|
|
cb8e9e |
- var_run_dir, GLUSTER_SHARED_STORAGE_BRICK_DIR);
|
|
|
cb8e9e |
-
|
|
|
cb8e9e |
snprintf (cmd_log_filename, PATH_MAX, "%s/cmd_history.log",
|
|
|
cb8e9e |
DEFAULT_LOG_FILE_DIRECTORY);
|
|
|
cb8e9e |
ret = gf_cmd_log_init (cmd_log_filename);
|
|
|
cb8e9e |
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
cb8e9e |
index cfe7a7b..c72c569 100644
|
|
|
cb8e9e |
--- a/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
cb8e9e |
+++ b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
cb8e9e |
@@ -513,10 +513,10 @@ typedef enum {
|
|
|
cb8e9e |
#define GLUSTERD_MISSED_SNAPS_LIST_FILE "missed_snaps_list"
|
|
|
cb8e9e |
#define GLUSTERD_VOL_SNAP_DIR_PREFIX "snaps"
|
|
|
cb8e9e |
|
|
|
cb8e9e |
-#define GLUSTERD_DEFAULT_SNAPS_BRICK_DIR "/gluster/snaps"
|
|
|
cb8e9e |
-#define GLUSTER_SHARED_STORAGE_BRICK_DIR "/gluster/ss_brick"
|
|
|
cb8e9e |
-#define GLUSTERD_VAR_RUN_DIR "/var/run"
|
|
|
cb8e9e |
-#define GLUSTERD_RUN_DIR "/run"
|
|
|
cb8e9e |
+#define GLUSTERD_DEFAULT_SNAPS_BRICK_DIR "/gluster/snaps"
|
|
|
cb8e9e |
+#define GLUSTER_SHARED_STORAGE_BRICK_DIR GLUSTERD_DEFAULT_WORKDIR"/ss_brick"
|
|
|
cb8e9e |
+#define GLUSTERD_VAR_RUN_DIR "/var/run"
|
|
|
cb8e9e |
+#define GLUSTERD_RUN_DIR "/run"
|
|
|
cb8e9e |
|
|
|
cb8e9e |
/* definitions related to replace brick */
|
|
|
cb8e9e |
#define RB_CLIENT_MOUNTPOINT "rb_mount"
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|