From: lhh@sourceware.org <lhh@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/rgmanager/src/daemons resrules.c
Date: 20 Oct 2006 20:29:16 -0000 [thread overview]
Message-ID: <20061020202916.32496.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2006-10-20 20:29:16
Modified files:
rgmanager/src/daemons: resrules.c
Log message:
Compatibility fix for resource agents between linux-cluster and linux-ha
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&r1=1.14&r2=1.15
--- cluster/rgmanager/src/daemons/resrules.c 2006/08/31 12:00:13 1.14
+++ cluster/rgmanager/src/daemons/resrules.c 2006/10/20 20:29:16 1.15
@@ -394,6 +394,48 @@
/**
+ Take the first unique + required attr and call it the 'primary' attr
+ for rgmanager. If there's no primary, index 0 becomes the primary attr.
+ */
+int
+choose_primary(resource_attr_t *attrs)
+{
+ int x = 0, primary = 0;
+ int flags;
+ char *name, *val;
+
+ if (!attrs)
+ return 0;
+
+ for (x = 0; attrs[x].ra_name; x++) {
+
+ if ((attrs[x].ra_flags & (RA_UNIQUE | RA_REQUIRED)) ==
+ (RA_UNIQUE | RA_REQUIRED)) {
+ primary = x;
+ break;
+ }
+ }
+
+ if (primary != 0) {
+ flags = attrs[primary].ra_flags | RA_PRIMARY;
+ name = attrs[primary].ra_name;
+ val = attrs[primary].ra_value;
+
+ attrs[primary].ra_flags = attrs[0].ra_flags;
+ attrs[primary].ra_name = attrs[0].ra_name;
+ attrs[primary].ra_value = attrs[0].ra_value;
+
+ attrs[0].ra_flags = flags;
+ attrs[0].ra_name = name;
+ attrs[0].ra_value = val;
+ } else {
+ attrs[0].ra_flags |= RA_PRIMARY;
+ }
+
+ return 0;
+}
+
+/**
Store a child type in the child array of a resource rule.
XXX Could be rewritten to use list macros.
@@ -662,6 +704,9 @@
store_attribute(&rr->rr_attrs, attrname, ret, flags);
}
+ if (!primary_found)
+ choose_primary(rr->rr_attrs);
+
return 0;
}
next reply other threads:[~2006-10-20 20:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-20 20:29 lhh [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-01-30 20:00 [Cluster-devel] cluster/rgmanager/src/daemons resrules.c lhh
2008-01-30 20:00 lhh
2007-05-31 18:37 lhh
2006-10-20 20:59 lhh
2006-10-20 20:57 lhh
2006-10-20 20:29 lhh
2006-08-31 12:00 mgrac
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=20061020202916.32496.qmail@sourceware.org \
--to=lhh@sourceware.org \
/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).