summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-messages.h10
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c14
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-reset-brick.c79
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c44
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c2
9 files changed, 89 insertions, 80 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index b1b13a49f71..21e3377b631 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -1883,7 +1883,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = glusterd_validate_and_create_brickpath (brickinfo,
volinfo->volume_id,
- op_errstr, is_force);
+ op_errstr, is_force,
+ _gf_false);
if (ret)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index 8cfc26ce905..e66107c3b24 100644
--- a/xlators/mgmt/glusterd/src/glusterd-messages.h
+++ b/xlators/mgmt/glusterd/src/glusterd-messages.h
@@ -41,7 +41,7 @@
#define GLUSTERD_COMP_BASE GLFS_MSGID_GLUSTERD
-#define GLFS_NUM_MESSAGES 600
+#define GLFS_NUM_MESSAGES 601
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
@@ -4853,6 +4853,14 @@
*/
#define GD_MSG_GNFS_XLATOR_NOT_INSTALLED (GLUSTERD_COMP_BASE + 600)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_PIDFILE_UNLINKING (GLUSTERD_COMP_BASE + 601)
+
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 3558ae91059..1a12b0e7160 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -6196,8 +6196,6 @@ glusterd_bricks_select_stop_volume (dict_t *dict, char **op_errstr,
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_pending_node_t *pending_node = NULL;
- glusterd_conf_t *conf = THIS->private;
- char pidfile[PATH_MAX] = {0,};
ret = glusterd_op_stop_volume_args_get (dict, &volname, &flags);
if (ret)
@@ -6233,11 +6231,6 @@ glusterd_bricks_select_stop_volume (dict_t *dict, char **op_errstr,
*/
brickinfo->status = GF_BRICK_STOPPED;
brickinfo->started_here = _gf_false;
- GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo,
- brickinfo, conf);
- gf_log (THIS->name, GF_LOG_INFO,
- "unlinking pidfile %s", pidfile);
- (void) sys_unlink (pidfile);
}
}
@@ -6260,8 +6253,6 @@ glusterd_bricks_select_remove_brick (dict_t *dict, char **op_errstr,
glusterd_pending_node_t *pending_node = NULL;
int32_t command = 0;
int32_t force = 0;
- glusterd_conf_t *conf = THIS->private;
- char pidfile[PATH_MAX] = {0,};
ret = dict_get_str (dict, "volname", &volname);
@@ -6342,11 +6333,6 @@ glusterd_bricks_select_remove_brick (dict_t *dict, char **op_errstr,
*/
brickinfo->status = GF_BRICK_STOPPED;
brickinfo->started_here = _gf_false;
- GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo,
- brickinfo, conf);
- gf_log (THIS->name, GF_LOG_INFO,
- "unlinking pidfile %s", pidfile);
- (void) sys_unlink (pidfile);
}
i++;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index fb29c6efcfd..887c3496475 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -252,7 +252,8 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
if (gf_is_local_addr (host)) {
ret = glusterd_validate_and_create_brickpath (dst_brickinfo,
volinfo->volume_id,
- op_errstr, is_force);
+ op_errstr, is_force,
+ _gf_false);
if (ret)
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
index 2e547c7e09f..c127d64d119 100644
--- a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
@@ -47,6 +47,7 @@ glusterd_reset_brick_prevalidate (dict_t *dict, char **op_errstr,
char pidfile[PATH_MAX] = {0};
xlator_t *this = NULL;
gf_boolean_t is_force = _gf_false;
+ int32_t ignore_partition = 0;
pid_t pid = -1;
uuid_t volume_id = {0,};
char *dup_dstbrick = NULL;
@@ -153,11 +154,14 @@ glusterd_reset_brick_prevalidate (dict_t *dict, char **op_errstr,
volinfo->rep_brick.src_brick = src_brickinfo;
volinfo->rep_brick.dst_brick = dst_brickinfo;
+ ret = dict_get_int32 (dict, "ignore-partition", &ignore_partition);
+ ret = 0;
if (gf_is_local_addr (host)) {
ret = glusterd_validate_and_create_brickpath
(dst_brickinfo,
volinfo->volume_id,
- op_errstr, is_force);
+ op_errstr, is_force,
+ ignore_partition);
if (ret)
goto out;
} else {
@@ -234,17 +238,16 @@ out:
int
glusterd_op_reset_brick (dict_t *dict, dict_t *rsp_dict)
{
- int ret = 0;
- char *op = NULL;
- glusterd_volinfo_t *volinfo = NULL;
- char *volname = NULL;
- xlator_t *this = NULL;
- glusterd_conf_t *priv = NULL;
- char *src_brick = NULL;
- char *dst_brick = NULL;
- glusterd_brickinfo_t *src_brickinfo = NULL;
- glusterd_brickinfo_t *dst_brickinfo = NULL;
- char pidfile[PATH_MAX] = {0,};
+ int ret = 0;
+ char *op = NULL;
+ glusterd_volinfo_t *volinfo = NULL;
+ char *volname = NULL;
+ xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
+ char *src_brick = NULL;
+ char *dst_brick = NULL;
+ glusterd_brickinfo_t *src_brickinfo = NULL;
+ glusterd_brickinfo_t *dst_brickinfo = NULL;
this = THIS;
GF_ASSERT (this);
@@ -289,26 +292,18 @@ glusterd_op_reset_brick (dict_t *dict, dict_t *rsp_dict)
}
if (!strcmp (op, "GF_RESET_OP_START")) {
- (void) glusterd_brick_disconnect (src_brickinfo);
- GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo,
- src_brickinfo, priv);
- ret = glusterd_service_stop ("brick", pidfile,
- SIGTERM, _gf_false);
- if (ret == 0) {
- glusterd_set_brick_status (src_brickinfo,
- GF_BRICK_STOPPED);
- (void) glusterd_brick_unlink_socket_file
- (volinfo, src_brickinfo);
- gf_msg (this->name, GF_LOG_INFO, 0,
- GD_MSG_BRICK_CLEANUP_SUCCESS,
- "Brick cleanup successful.");
- } else {
+ ret = glusterd_volume_stop_glusterfs (volinfo,
+ src_brickinfo,
+ _gf_false);
+ if (ret) {
gf_msg (this->name, GF_LOG_CRITICAL, 0,
- GD_MSG_BRK_CLEANUP_FAIL,
- "Unable to cleanup src brick");
- goto out;
+ GD_MSG_BRICK_STOP_FAIL, "Unable to stop"
+ " brick: %s:%s", src_brickinfo->hostname,
+ src_brickinfo->path);
}
+
goto out;
+
} else if (!strcmp (op, "GF_RESET_OP_COMMIT") ||
!strcmp (op, "GF_RESET_OP_COMMIT_FORCE")) {
ret = dict_get_str (dict, "dst-brick", &dst_brick);
@@ -344,25 +339,17 @@ glusterd_op_reset_brick (dict_t *dict, dict_t *rsp_dict)
if (ret)
goto out;
- if (gf_is_local_addr (dst_brickinfo->hostname)) {
+ if (gf_uuid_compare (dst_brickinfo->uuid, MY_UUID)) {
gf_msg_debug (this->name, 0, "I AM THE DESTINATION HOST");
- (void) glusterd_brick_disconnect (src_brickinfo);
- GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo,
- src_brickinfo, priv);
- ret = glusterd_service_stop ("brick", pidfile,
- SIGTERM, _gf_false);
- if (ret == 0) {
- glusterd_set_brick_status
- (src_brickinfo, GF_BRICK_STOPPED);
- (void) glusterd_brick_unlink_socket_file
- (volinfo, src_brickinfo);
- gf_msg (this->name, GF_LOG_INFO, 0,
- GD_MSG_BRICK_CLEANUP_SUCCESS,
- "Brick cleanup successful.");
- } else {
+ ret = glusterd_volume_stop_glusterfs (volinfo,
+ src_brickinfo,
+ _gf_true);
+ if (ret) {
gf_msg (this->name, GF_LOG_CRITICAL, 0,
- GD_MSG_BRK_CLEANUP_FAIL,
- "Unable to cleanup src brick");
+ GD_MSG_BRICK_STOP_FAIL,
+ "Unable to stop brick: %s:%s",
+ src_brickinfo->hostname,
+ src_brickinfo->path);
goto out;
}
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 78a4652cf41..31f4d95f63d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -2753,8 +2753,6 @@ glusterd_do_lvm_snapshot_remove (glusterd_volinfo_t *snap_vol,
GLUSTERD_GET_BRICK_PIDFILE (pidfile, snap_vol, brickinfo, priv);
if (gf_is_service_running (pidfile, &pid)) {
- int send_attach_req (xlator_t *this, struct rpc_clnt *rpc,
- char *path, int op);
(void) send_attach_req (this, brickinfo->rpc,
brickinfo->path,
GLUSTERD_BRICK_TERMINATE);
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 0a4aea24d85..a66e04934db 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -96,8 +96,8 @@
int
send_attach_req (xlator_t *this, struct rpc_clnt *rpc, char *path, int op);
-static gf_boolean_t
-is_brick_mx_enabled ()
+gf_boolean_t
+is_brick_mx_enabled (void)
{
char *value = NULL;
int ret = 0;
@@ -1329,7 +1329,8 @@ out:
int
glusterd_validate_and_create_brickpath (glusterd_brickinfo_t *brickinfo,
uuid_t volume_id, char **op_errstr,
- gf_boolean_t is_force)
+ gf_boolean_t is_force,
+ gf_boolean_t ignore_partition)
{
int ret = -1;
char parentdir[PATH_MAX] = {0,};
@@ -1403,8 +1404,14 @@ glusterd_validate_and_create_brickpath (glusterd_brickinfo_t *brickinfo,
" Or use 'force' at the end of the command if"
" you want to override this behavior.",
brickinfo->hostname, brickinfo->path);
- ret = -1;
- goto out;
+
+ /* If --wignore-partition flag is used, ignore warnings
+ * related to bricks being on root partition when 'force'
+ * is not used */
+ if (!ignore_partition) {
+ ret = -1;
+ goto out;
+ }
}
}
@@ -2074,13 +2081,15 @@ glusterd_brick_disconnect (glusterd_brickinfo_t *brickinfo)
}
int32_t
-glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
- glusterd_brickinfo_t *brickinfo,
+glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
+ glusterd_brickinfo_t *brickinfo,
gf_boolean_t del_brick)
{
xlator_t *this = NULL;
- int ret = 0;
+ glusterd_conf_t *conf = NULL;
+ int ret = -1;
char *op_errstr = NULL;
+ char pidfile[PATH_MAX] = {0,};
GF_ASSERT (volinfo);
GF_ASSERT (brickinfo);
@@ -2088,6 +2097,11 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
this = THIS;
GF_ASSERT (this);
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, conf, out);
+
+ ret = 0;
+
if (del_brick)
cds_list_del_init (&brickinfo->brick_list);
@@ -2102,10 +2116,17 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
* an actual signal instead.
*/
if (is_brick_mx_enabled ()) {
+ gf_msg_debug (this->name, 0, "About to send detach "
+ "request for brick %s:%s",
+ brickinfo->hostname, brickinfo->path);
+
(void) send_attach_req (this, brickinfo->rpc,
brickinfo->path,
GLUSTERD_BRICK_TERMINATE);
} else {
+ gf_msg_debug (this->name, 0, "About to stop glusterfsd"
+ " for brick %s:%s", brickinfo->hostname,
+ brickinfo->path);
(void) glusterd_brick_terminate (volinfo, brickinfo,
NULL, 0, &op_errstr);
if (op_errstr) {
@@ -2119,6 +2140,10 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
if (del_brick)
glusterd_delete_brick (volinfo, brickinfo);
+ GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, conf);
+ gf_msg_debug (this->name, 0, "Unlinking pidfile %s", pidfile);
+ (void) sys_unlink (pidfile);
+out:
return ret;
}
@@ -6563,9 +6588,6 @@ glusterd_brick_stop (glusterd_volinfo_t *volinfo,
goto out;
}
- gf_msg_debug (this->name, 0, "About to stop glusterfs"
- " for brick %s:%s", brickinfo->hostname,
- brickinfo->path);
ret = glusterd_volume_stop_glusterfs (volinfo, brickinfo, del_brick);
if (ret) {
gf_msg (this->name, GF_LOG_CRITICAL, 0,
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index d002ee45b6c..d694a312a41 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -80,6 +80,8 @@ typedef struct glusterd_dict_ctx_ {
char *prefix;
} glusterd_dict_ctx_t;
+gf_boolean_t is_brick_mx_enabled (void);
+
int
glusterd_compare_lines (const void *a, const void *b);
@@ -179,10 +181,13 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
gf_boolean_t wait);
int32_t
-glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
- glusterd_brickinfo_t *brickinfo,
+glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
+ glusterd_brickinfo_t *brickinfo,
gf_boolean_t del_brick);
+int
+send_attach_req (xlator_t *this, struct rpc_clnt *rpc, char *path, int op);
+
glusterd_volinfo_t *
glusterd_volinfo_ref (glusterd_volinfo_t *volinfo);
@@ -310,7 +315,8 @@ glusterd_check_and_set_brick_xattr (char *host, char *path, uuid_t uuid,
int
glusterd_validate_and_create_brickpath (glusterd_brickinfo_t *brickinfo,
uuid_t volume_id, char **op_errstr,
- gf_boolean_t is_force);
+ gf_boolean_t is_force,
+ gf_boolean_t ignore_partition);
int
glusterd_sm_tr_log_transition_add (glusterd_sm_tr_log_t *log,
int old_state, int new_state,
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 4738dc589d5..95056d501a3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1316,7 +1316,7 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr,
#endif
ret = glusterd_validate_and_create_brickpath (brick_info,
volume_uuid, op_errstr,
- is_force);
+ is_force, _gf_false);
if (ret)
goto out;