public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - rgmanager: Fix referencing bug
@ 2009-08-21 16:59 Lon Hohberger
  0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2009-08-21 16:59 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d3764cf043a0e260f545fd202cd9bb29fb3425bb
Commit:        d3764cf043a0e260f545fd202cd9bb29fb3425bb
Parent:        495d7fcd5e75a3591ca32708e4d05b44a1573d36
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Fri Aug 21 10:28:25 2009 -0400
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Fri Aug 21 10:28:25 2009 -0400

rgmanager: Fix referencing bug

If you placed a resource in the <resources> block
and it did not have a primary="1" attribute in the
resource agent metadata, rgmanager would ignore it
in the resource tree when you tried to address it
using the ref="" keyword.

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
 rgmanager/src/daemons/reslist.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/rgmanager/src/daemons/reslist.c b/rgmanager/src/daemons/reslist.c
index fac4812..7a2d69a 100644
--- a/rgmanager/src/daemons/reslist.c
+++ b/rgmanager/src/daemons/reslist.c
@@ -257,7 +257,8 @@ resource_t *
 find_resource_by_ref(resource_t **reslist, const char *type, const char *ref)
 {
 	resource_t *curr;
-	int x;
+	resource_t *first_possible = NULL;
+	int x, flags = RA_UNIQUE|RA_REQUIRED;
 
 	list_do(reslist, curr) {
 		if (strcmp(curr->r_rule->rr_type, type))
@@ -269,16 +270,18 @@ find_resource_by_ref(resource_t **reslist, const char *type, const char *ref)
 		 */
 		for (x = 0; curr->r_attrs && curr->r_attrs[x].ra_name;
 		     x++) {
-			if (!(curr->r_attrs[x].ra_flags & RA_PRIMARY))
-				continue;
 			if (strcmp(ref, curr->r_attrs[x].ra_value))
 				continue;
-
+			if (((curr->r_attrs[x].ra_flags & flags) == flags) &&
+		    	    !first_possible)
+				first_possible = curr;
+			if (!(curr->r_attrs[x].ra_flags & RA_PRIMARY))
+				continue;
 			return curr;
 		}
 	} while (!list_done(reslist, curr));
 
-	return NULL;
+	return first_possible;
 }
 
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-08-21 16:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-21 16:59 cluster: STABLE3 - rgmanager: Fix referencing bug Lon Hohberger

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 read-only IMAP folder(s) and NNTP newsgroup(s).