[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 2/2] rgmanager: Send events on service stop & preserve frozen flag [RHEL5]



The rgmanger FROZEN flag is supposed to persist until disabled
explicitly by an administrator or loss of quorum.

Resolves: rhbz#722230

Signed-off-by: Lon Hohberger <lhh redhat com>
---
 rgmanager/include/event.h        |    1 +
 rgmanager/src/daemons/groups.c   |   15 +++++++++++++--
 rgmanager/src/daemons/rg_state.c |    3 ++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/rgmanager/include/event.h b/rgmanager/include/event.h
index e63dffd..4a1714f 100644
--- a/rgmanager/include/event.h
+++ b/rgmanager/include/event.h
@@ -137,6 +137,7 @@ int slang_process_event(event_table_t *event_table, event_t *ev);
 /* For distributed events. */
 void set_transition_throttling(int nsecs);
 int get_transition_throttling(void);
+void broadcast_event(char *svcName, uint32_t state, int owner, int last);
 
 /* Simplified service start. */
 int service_op_start(char *svcName, int *target_list, int target_list_len,
diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c
index 77f0d05..20ed2e1 100644
--- a/rgmanager/src/daemons/groups.c
+++ b/rgmanager/src/daemons/groups.c
@@ -701,7 +701,7 @@ eval_groups(int local, uint32_t nodeid, int nodeStatus)
 	resource_node_t *node;
 	rg_state_t svcStatus;
 	cluster_member_list_t *membership;
-	int ret;
+	int ret, state_updated = 0;
 
 	if (rg_locked()) {
 		clulog(LOG_DEBUG,
@@ -718,6 +718,7 @@ eval_groups(int local, uint32_t nodeid, int nodeStatus)
 
 	list_do(&_tree, node) {
 
+		state_updated = 0;
 		res_build_name(svcName, sizeof(svcName), node->rn_resource);
 
 		/*
@@ -756,7 +757,9 @@ eval_groups(int local, uint32_t nodeid, int nodeStatus)
 			svcStatus.rs_state = RG_STATE_STOPPED;
 			svcStatus.rs_owner = 0;
 			svcStatus.rs_transition = (uint64_t)time(NULL);
-			svcStatus.rs_flags = 0;
+			/* If host fails, we need to remember
+			 * frozen flag */
+			svcStatus.rs_flags &= RG_FLAG_FROZEN;
 
 			if (set_rg_state(svcName, &svcStatus) != 0) {
 				clulog(LOG_ERR, "Failed to update state"
@@ -765,10 +768,18 @@ eval_groups(int local, uint32_t nodeid, int nodeStatus)
 				rg_unlock(&lockp);
 				continue;
 			}
+
+			state_updated = 1;
 		}
 
 		rg_unlock(&lockp);
 
+		if (state_updated) {
+			/* don't do this with lock held */
+			broadcast_event(svcName, RG_STATE_STOPPED, -1,
+					svcStatus.rs_last_owner);
+		}
+
 		if (svcStatus.rs_owner == 0)
 			nodeName = "none";
 		else
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index c02bfda..a8b1e36 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -1549,7 +1549,8 @@ _svc_stop_finish(char *svcName, int failed, uint32_t newstate)
 	}
 
 	svcStatus.rs_state = newstate;
-	svcStatus.rs_flags = 0;
+	/* If host fails, we need to remember frozen flag */
+	svcStatus.rs_flags &= RG_FLAG_FROZEN;
 
 	clulog(LOG_NOTICE, "Service %s is %s\n", svcName,
 	       rg_state_str(svcStatus.rs_state));
-- 
1.7.3.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]