All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio M. Di Nitto <fdinitto@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/2] rgmanager: Send events on service stop & preserve frozen flag [RHEL5]
Date: Fri, 28 Oct 2011 06:44:44 +0200	[thread overview]
Message-ID: <4EAA333C.8070009@redhat.com> (raw)
In-Reply-To: <1319758339-30399-2-git-send-email-lhh@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));



      reply	other threads:[~2011-10-28  4:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EAA333C.8070009@redhat.com \
    --to=fdinitto@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.