From: Fabio M. Di Nitto <fdinitto@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] rhel5 rgmanager: Improve rgmanager's exclusive prioritization handling
Date: Thu, 07 Apr 2011 19:06:00 +0200 [thread overview]
Message-ID: <4D9DEEF8.4050102@redhat.com> (raw)
In-Reply-To: <1302183963-17337-1-git-send-email-lhh@redhat.com>
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()
prev parent reply other threads:[~2011-04-07 17:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-07 13:46 [Cluster-devel] [PATCH] rhel5 rgmanager: Improve rgmanager's exclusive prioritization handling Lon Hohberger
2011-04-07 17:06 ` 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=4D9DEEF8.4050102@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).