All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH 1/2] rgmanager: Mark services on dead nodes as stopped [RHEL5]
@ 2011-10-27 23:32 Lon Hohberger
  2011-10-27 23:32 ` [Cluster-devel] [PATCH 2/2] rgmanager: Send events on service stop & preserve frozen flag [RHEL5] Lon Hohberger
  0 siblings, 1 reply; 3+ messages in thread
From: Lon Hohberger @ 2011-10-27 23:32 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Cleans up clustat reporting and avoids a race.

Resolves: rhbz#722230

Signed-off-by: Lon Hohberger <lhh@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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Cluster-devel] [PATCH 2/2] rgmanager: Send events on service stop & preserve frozen flag [RHEL5]
  2011-10-27 23:32 [Cluster-devel] [PATCH 1/2] rgmanager: Mark services on dead nodes as stopped [RHEL5] Lon Hohberger
@ 2011-10-27 23:32 ` Lon Hohberger
  2011-10-28  4:44   ` Fabio M. Di Nitto
  0 siblings, 1 reply; 3+ messages in thread
From: Lon Hohberger @ 2011-10-27 23:32 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Cluster-devel] [PATCH 2/2] rgmanager: Send events on service stop & preserve frozen flag [RHEL5]
  2011-10-27 23:32 ` [Cluster-devel] [PATCH 2/2] rgmanager: Send events on service stop & preserve frozen flag [RHEL5] Lon Hohberger
@ 2011-10-28  4:44   ` Fabio M. Di Nitto
  0 siblings, 0 replies; 3+ messages in thread
From: Fabio M. Di Nitto @ 2011-10-28  4:44 UTC (permalink / raw)
  To: cluster-devel.redhat.com

ACK both patches.

Fabio

On 10/28/2011 01:32 AM, Lon Hohberger wrote:
> 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));



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-28  4:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-27 23:32 [Cluster-devel] [PATCH 1/2] rgmanager: Mark services on dead nodes as stopped [RHEL5] Lon Hohberger
2011-10-27 23:32 ` [Cluster-devel] [PATCH 2/2] rgmanager: Send events on service stop & preserve frozen flag [RHEL5] Lon Hohberger
2011-10-28  4:44   ` Fabio M. Di Nitto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.