public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: rgmanager: master - rgmanager: Fix referencing bug
Date: Mon, 24 Aug 2009 13:27:00 -0000	[thread overview]
Message-ID: <20090824132715.C3636120107@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/rgmanager.git?p=rgmanager.git;a=commitdiff;h=66ce9f84a4634282968cd8a4e2bb4dbe19a5844a
Commit:        66ce9f84a4634282968cd8a4e2bb4dbe19a5844a
Parent:        52ae93b6f6f90893b550eb7eba3cb5e84bdad499
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Fri Aug 21 10:28:25 2009 -0400
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Mon Aug 24 09:27:01 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 4656e43..57504da 100644
--- a/rgmanager/src/daemons/reslist.c
+++ b/rgmanager/src/daemons/reslist.c
@@ -259,7 +259,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))
@@ -271,16 +272,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;
 }
 
 


                 reply	other threads:[~2009-08-24 13:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090824132715.C3636120107@lists.fedorahosted.org \
    --to=lon@fedoraproject.org \
    --cc=cluster-cvs-relay@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 read-only IMAP folder(s) and NNTP newsgroup(s).