summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav Kumar Garg <garg.gaurav52@gmail.com>2015-12-01 19:14:08 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-12-03 20:09:06 -0800
commit4322c4103325c8ddfceafb5b49f96f96890e2f8b (patch)
treeb464491ff1e65399fb9e0ef4264f28ea255c2c96
parent45c2a17ce96d4802ddd2b36a5131b64caa8b1a3c (diff)
glusterd: stop daemon services upon peer detach correctly
This patch is backport of: http://review.gluster.org/#/c/12838/ Problem: Currently glusterd is stopping all the daemons service upon peer detach. If user have multi node cluster and if user want to detach any node from the cluster, and detached node having stand alone volume then upon detaching glusterd stopping all the daemon's of the detached node, which is having running volume. Fix: Upon peer detach it should do peer detach cleanup properly and it should stop only those daemon on the node on which it require. >> Change-Id: I98b8099166f82e235ded6d02261f59a6511a003b >> BUG: 1287455 >> Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> >> Reviewed-on: http://review.gluster.org/12838 >> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> >> Tested-by: NetBSD Build System <jenkins@build.gluster.org> >> Tested-by: Gluster Build System <jenkins@build.gluster.com> Change-Id: I98b8099166f82e235ded6d02261f59a6511a003b BUG: 1288056 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> (cherry picked from commit cae9512d60f5715459ea5883c657c679197982d9) Reviewed-on: http://review.gluster.org/12873 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c28
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c31
2 files changed, 41 insertions, 18 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index 48ad1a8dfde..9c772ba4d4b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -613,17 +613,6 @@ glusterd_peer_detach_cleanup (glusterd_conf_t *priv)
cds_list_for_each_entry_safe (volinfo, tmp_volinfo, &priv->volumes,
vol_list) {
- /* Stop snapd daemon service if snapd daemon is running*/
- if (!volinfo->is_snap_volume) {
- svc = &(volinfo->snapd.svc);
- ret = svc->stop (svc, SIGTERM);
- if (ret) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0,
- GD_MSG_SVC_STOP_FAIL, "Failed to "
- "stop snapd daemon service.");
- }
- }
-
/* The peer detach checks make sure that, at this point in the
* detach process, there are only volumes contained completely
* within or completely outside the detached peer.
@@ -636,6 +625,17 @@ glusterd_peer_detach_cleanup (glusterd_conf_t *priv)
GD_MSG_STALE_VOL_DELETE_INFO,
"Deleting stale volume %s", volinfo->volname);
+ /*Stop snapd daemon service if snapd daemon is running*/
+ if (!volinfo->is_snap_volume) {
+ svc = &(volinfo->snapd.svc);
+ ret = svc->stop (svc, SIGTERM);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_SVC_STOP_FAIL, "Failed "
+ "to stop snapd daemon service");
+ }
+ }
+
ret = glusterd_cleanup_snaps_for_volume (volinfo);
if (ret) {
gf_msg (THIS->name, GF_LOG_ERROR, 0,
@@ -653,12 +653,12 @@ glusterd_peer_detach_cleanup (glusterd_conf_t *priv)
}
}
- /* Stop all daemon services of Detaching node once peer detached */
- ret = glusterd_svcs_stop ();
+ /*Reconfigure all daemon services upon peer detach*/
+ ret = glusterd_svcs_reconfigure ();
if (ret) {
gf_msg (THIS->name, GF_LOG_ERROR, 0,
GD_MSG_SVC_STOP_FAIL,
- "Failed to stop all daemon services.");
+ "Failed to reconfigure all daemon services.");
}
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 75cb34baf37..5dde7b711a7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6794,10 +6794,11 @@ glusterd_friend_contains_vol_bricks (glusterd_volinfo_t *volinfo,
int
glusterd_friend_remove_cleanup_vols (uuid_t uuid)
{
- int ret = -1;
- glusterd_conf_t *priv = NULL;
- glusterd_volinfo_t *volinfo = NULL;
- glusterd_volinfo_t *tmp_volinfo = NULL;
+ int ret = -1;
+ glusterd_conf_t *priv = NULL;
+ glusterd_svc_t *svc = NULL;
+ glusterd_volinfo_t *volinfo = NULL;
+ glusterd_volinfo_t *tmp_volinfo = NULL;
priv = THIS->private;
GF_ASSERT (priv);
@@ -6816,6 +6817,28 @@ glusterd_friend_remove_cleanup_vols (uuid_t uuid)
goto out;
}
}
+
+ if (!glusterd_friend_contains_vol_bricks (volinfo,
+ MY_UUID)) {
+ /*Stop snapd daemon service if snapd daemon is running*/
+ if (!volinfo->is_snap_volume) {
+ svc = &(volinfo->snapd.svc);
+ ret = svc->stop (svc, SIGTERM);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_SVC_STOP_FAIL, "Failed "
+ "to stop snapd daemon service");
+ }
+ }
+ }
+ }
+
+ /* Reconfigure all daemon services upon peer detach */
+ ret = glusterd_svcs_reconfigure ();
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_SVC_STOP_FAIL,
+ "Failed to reconfigure all daemon services.");
}
ret = 0;
out: