From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5405 invoked by alias); 21 Aug 2009 16:59:07 -0000 Received: (qmail 5398 invoked by alias); 21 Aug 2009 16:59:07 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: STABLE3 - rgmanager: Fix referencing bug To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: 495d7fcd5e75a3591ca32708e4d05b44a1573d36 X-Git-Newrev: d3764cf043a0e260f545fd202cd9bb29fb3425bb From: Lon Hohberger Message-Id: <20090821165838.EDD7C1201E6@lists.fedorahosted.org> Date: Fri, 21 Aug 2009 16:59:00 -0000 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00233.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d3764cf043a0e260f545fd202cd9bb29fb3425bb Commit: d3764cf043a0e260f545fd202cd9bb29fb3425bb Parent: 495d7fcd5e75a3591ca32708e4d05b44a1573d36 Author: Lon Hohberger AuthorDate: Fri Aug 21 10:28:25 2009 -0400 Committer: Lon Hohberger CommitterDate: Fri Aug 21 10:28:25 2009 -0400 rgmanager: Fix referencing bug If you placed a resource in the 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 --- 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; }