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

Re: [Cluster-devel] [PATCH] rhel5 rgmanager: Improve rgmanager's exclusive prioritization handling



ACK

On 04/07/2011 03:46 PM, Lon Hohberger wrote:
> Resolves: rhbz#680256
> 
> Signed-off-by: Lon Hohberger <lhh redhat com>
> ---
>  rgmanager/src/resources/default_event_script.sl |   72 ++++++++++++++++++-----
>  1 files changed, 56 insertions(+), 16 deletions(-)
> 
> diff --git a/rgmanager/src/resources/default_event_script.sl b/rgmanager/src/resources/default_event_script.sl
> index db6e789..d567465 100644
> --- a/rgmanager/src/resources/default_event_script.sl
> +++ b/rgmanager/src/resources/default_event_script.sl
> @@ -57,7 +57,7 @@ define separate_nodes(node_list)
>  define exclusive_prioritize(svc, node_list)
>  {
>  	variable services = service_list();
> -	variable len, x, y, owner, state, preferred_owner;
> +	variable len, x, y, owner, nowner, state, preferred_owner;
>  	variable svc_excl, other_excl;
>  	variable nodes_x, nodes_s, nodes_e;
>  
> @@ -66,7 +66,8 @@ define exclusive_prioritize(svc, node_list)
>  	%
>  	svc_excl = atoi(service_property(svc, "exclusive"));
>  	if (svc_excl == 0) {
> -		return node_list;
> +		notice("Starting ", svc, " on ", node_list);
> +		return service_start(svc, node_list);
>  	}
>  
>  	(nodes_e, nodes_s, nodes_x) = separate_nodes(node_list);
> @@ -76,7 +77,11 @@ define exclusive_prioritize(svc, node_list)
>  		% If we've got an exclusive service, only allow it to start on 
>  		% empty nodes.
>  		%
> -		return nodes_e;
> +		notice("Starting ", svc, " on ", nodes_e);
> +		nowner = service_start(svc, nodes_e);
> +		if ((nowner > 0) or (nowner != FAIL)) {
> +			return nowner;
> +		}
>  	}
>  
>  	if (length(nodes_x) == 0) {
> @@ -85,7 +90,7 @@ define exclusive_prioritize(svc, node_list)
>  		% and no empty nodes, the service can not be started
>  		%
>  		notice("No empty / exclusive nodes available; cannot restart ", svc);
> -		return nodes_x;
> +		return ERR_DOMAIN;
>  	}
>  
>  	%
> @@ -129,14 +134,16 @@ define exclusive_prioritize(svc, node_list)
>  		() = service_stop(services[x]);
>  
>  		%
> -		% Return just the one node.
> +		% Try just the one node.
>  		%
> -		node_list = subtract([0], 0);
> -		node_list = union(node_list, owner);
> -		return node_list;
> +		notice("Starting ", svc, " on ", owner);
> +		nowner = service_start(svc, owner);
> +		if ((nowner > 0) or (nowner != FAIL)) {
> +			return nowner;
> +		}
>  	}
>  
> -	return node_list;
> +	return ERR_DOMAIN;
>  }
>  
>  
> @@ -200,13 +207,13 @@ define move_or_start(service, node_list)
>  			return ERR_ABORT;
>  		}
>  	} else {
> -		node_list = exclusive_prioritize(service, node_list);
> -		notice("Starting ", service, " on ", node_list);
> +		return exclusive_prioritize(service, node_list);
>  	}
>  
>  	if (length(node_list) == 0) {
>  		return ERR_DOMAIN; 
>  	}
> +	notice("Starting ", service, " on ", node_list);
>  	return service_start(service, node_list);
>  }
>  
> @@ -428,7 +435,7 @@ define default_node_event_handler()
>  define default_service_event_handler()
>  {
>  	variable services = service_list();
> -	variable x;
> +	variable x, excl, len;
>  	variable depends;
>  	variable depend_mode;
>  	variable policy;
> @@ -472,15 +479,16 @@ define default_service_event_handler()
>  		return;
>  	}
>  
> -	for (x = 0; x < length(services); x++) {
> +	%
> +	% Simplistic dependency handling
> +	%
> +	len = length(services);
> +	for (x = 0; x < len; x++) {
>  		if (service_name == services[x]) {
>  			% don't do anything to ourself! 
>  			continue;
>  		}
>  
> -		%
> -		% Simplistic dependency handling
> -		%
>  		depends = service_property(services[x], "depend");
>  		depend_mode = service_property(services[x], "depend_mode");
>  
> @@ -504,6 +512,38 @@ define default_service_event_handler()
>  			()=service_stop(services[x]);
>  		}
>  	}
> +
> +	%
> +	% Try to restart exclusive service which might have been recently
> +	% stopped in order to make room for other exclusive services.
> +	%
> +	% Note that as a side effect, exclusive services (>=2) can't be
> +	% stopped with clusvcadm -s; they will just pop right back - you
> +	% must disable them if want them to stay stopped.
> +	%
> +	% This code has a side effect of brute-forcing the lowest-priority
> +	% exclusive service offline in a cascaded fashion.
> +	%
> +	for (x = 0; x < len; x++) {
> +		if (service_name == services[x]) {
> +			% don't do anything to ourself!
> +			continue;
> +		}
> +
> +		excl = atoi(service_property(services[x], "exclusive"));
> +		% non-exclusive or highest-prio (1) shouldn't get here
> +		if ((excl == 0) or (excl == 1)) {
> +			continue;
> +		}
> +
> +		(,,, owner, state) = service_status(services[x]);
> +		if (state == "stopped") {
> +			info("Restarting stopped exclusive priority ",
> +			     excl, " service ", services[x]);
> +			nodes = allowed_nodes(services[x]);
> +			()=move_or_start(services[x], nodes);
> +		}
> +	}
>  }
>  
>  define default_config_event_handler()


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