Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=776... Commit: 7768c7ef868ed0010a66af2f9e6665930ef82a41 Parent: 7774de6ec56c9180eca121429207d0e82857bde5 Author: Lon Hohberger lhh@redhat.com AuthorDate: Thu Oct 27 17:54:58 2011 -0400 Committer: Lon Hohberger lhh@redhat.com CommitterDate: Fri Oct 28 09:04:24 2011 -0400
rgmanager: Send events on service stop & preserve frozen flag
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 Reviewed-by: Fabio M. Di Nitto fdinitto@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));
cluster-commits@lists.stg.fedorahosted.org