From 7774de6ec56c9180eca121429207d0e82857bde5 Mon Sep 17 00:00:00 2001 From: Lon Hohberger <lhh@redhat.com> Date: Thu, 11 Aug 2011 10:39:04 -0400 Subject: [PATCH] rgmanager: Mark services on dead nodes as stopped Cleans up clustat reporting and avoids a race. Resolves: rhbz#722230 Signed-off-by: Lon Hohberger <lhh@redhat.com> Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com> --- rgmanager/src/daemons/groups.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c index 1e93e03..77f0d05 100644 --- a/rgmanager/src/daemons/groups.c +++ b/rgmanager/src/daemons/groups.c @@ -741,6 +741,32 @@ eval_groups(int local, uint32_t nodeid, int nodeStatus) continue; } + /* Mark the service as stopped if applicable */ + if ((svcStatus.rs_owner == nodeid && !nodeStatus) && + (svcStatus.rs_state == RG_STATE_STARTED || + svcStatus.rs_state == RG_STATE_RECOVER || + svcStatus.rs_state == RG_STATE_STARTING || + svcStatus.rs_state == RG_STATE_STOPPING )) { + + clulog(LOG_DEBUG, + "Marking %s on down member %d as stopped", + svcName, nodeid); + + svcStatus.rs_last_owner = svcStatus.rs_owner; + svcStatus.rs_state = RG_STATE_STOPPED; + svcStatus.rs_owner = 0; + svcStatus.rs_transition = (uint64_t)time(NULL); + svcStatus.rs_flags = 0; + + if (set_rg_state(svcName, &svcStatus) != 0) { + clulog(LOG_ERR, "Failed to update state" + " of %s during recovery; cannot " + "fail over", svcName); + rg_unlock(&lockp); + continue; + } + } + rg_unlock(&lockp); if (svcStatus.rs_owner == 0) -- 1.7.3.4