cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] cluster/rgmanager ChangeLog src/daemons/reslist.c
@ 2007-04-26 20:40 lhh
  0 siblings, 0 replies; 3+ messages in thread
From: lhh @ 2007-04-26 20:40 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	lhh at sourceware.org	2007-04-26 21:40:28

Modified files:
	rgmanager      : ChangeLog 
	rgmanager/src/daemons: reslist.c 

Log message:
	Fix #231521

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.31.2.4&r2=1.31.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/reslist.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.14.2.2&r2=1.14.2.3

--- cluster/rgmanager/ChangeLog	2007/04/19 20:21:34	1.31.2.4
+++ cluster/rgmanager/ChangeLog	2007/04/26 20:40:28	1.31.2.5
@@ -1,3 +1,7 @@
+2007-04-26 Lon Hohberger <lhh@redhat.com>
+	* src/daemons/reslist.c: Try all direct ancestors while 
+	performing run-time inheritance resolution #231521
+
 2007-04-19 Lon Hohberger <lhh@redhat.com>
 	* src/daemons/groups.c, rg_state.c: Apply patch from Andrey
 	Mirkin to fix bug #237144; prevents exclusive services from
--- cluster/rgmanager/src/daemons/reslist.c	2007/03/23 00:06:34	1.14.2.2
+++ cluster/rgmanager/src/daemons/reslist.c	2007/04/26 20:40:28	1.14.2.3
@@ -79,17 +79,27 @@
 
    @param node		Resource tree node to look examine
    @param attrname	Attribute to retrieve.
+   @param ptype		Resource type to look for (if inheritance)
    @return 		value of attribute or NULL if not found
  */
-char *
-attr_value(resource_node_t *node, char *attrname)
+static char *
+_attr_value(resource_node_t *node, char *attrname, char *ptype)
 {
-	resource_t *res = node->rn_resource;
+	resource_t *res;
 	resource_attr_t *ra;
-	char *c, *p_type;
+	char *c, p_type[32];
 	ssize_t len;
 	int x;
 
+	if (!node)
+		return NULL;
+
+	res = node->rn_resource;
+
+	/* Go up the tree if it's not the right parent type */
+	if (ptype && strcmp(res->r_rule->rr_type, ptype))
+		return _attr_value(node->rn_parent, attrname, ptype);
+
 	for (x = 0; res->r_attrs && res->r_attrs[x].ra_name; x++) {
 		if (strcmp(attrname, res->r_attrs[x].ra_name))
 			continue;
@@ -108,28 +118,29 @@
 		if (!c) {
 			/* Someone doesn't care or uses older
 			   semantics on inheritance */
-			return attr_value(node->rn_parent, ra->ra_value);
+			return _attr_value(node->rn_parent, ra->ra_value,
+					   NULL);
 		}
-
-		p_type = node->rn_parent->rn_resource->r_rule->rr_type;
+		
 		len = (c - ra->ra_value);
-
-		/* Different sizes? */
-		if (strlen(p_type) != len)
-			return NULL;
-
-		/* Check for parent type match */
-		if (strncmp(p_type, ra->ra_value, len) != 0)
-			return NULL;
-
+		memset(p_type, 0, sizeof(p_type));
+		memcpy(p_type, ra->ra_value, len);
+		
 		/* Skip the "%" and recurse */
-		return attr_value(node->rn_parent, ++c);
+		return _attr_value(node->rn_parent, ++c, p_type);
 	}
 
 	return NULL;
 }
 
 
+char *
+attr_value(resource_node_t *node, char *attrname)
+{
+	return _attr_value(node, attrname, NULL);
+}
+
+
 /**
   Run to the top of the tree.  Used to determine certain attributes of the
   resource group in-line, during resource tree operations.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cluster-devel] cluster/rgmanager ChangeLog src/daemons/reslist.c
@ 2007-04-26 20:42 lhh
  0 siblings, 0 replies; 3+ messages in thread
From: lhh @ 2007-04-26 20:42 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	lhh at sourceware.org	2007-04-26 21:42:02

Modified files:
	rgmanager      : ChangeLog 
	rgmanager/src/daemons: reslist.c 

Log message:
	Fix #231521

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/reslist.c.diff?cvsroot=cluster&r1=1.17&r2=1.18

--- cluster/rgmanager/ChangeLog	2007/04/26 16:43:41	1.37
+++ cluster/rgmanager/ChangeLog	2007/04/26 20:42:02	1.38
@@ -1,3 +1,7 @@
+2007-04-26 Lon Hohberger <lhh@redhat.com>
+	* src/daemons/reslist.c: Try all direct ancestors while 
+	performing run-time inheritance resolution #231521
+
 2007-04-26 Fabio M. Di Nitto <fabbione@ubuntu.com>
 	* src/daemons/Makefile: use resrules-noccs in dtest build
 	target.
--- cluster/rgmanager/src/daemons/reslist.c	2007/03/22 23:46:58	1.17
+++ cluster/rgmanager/src/daemons/reslist.c	2007/04/26 20:42:02	1.18
@@ -79,17 +79,27 @@
 
    @param node		Resource tree node to look examine
    @param attrname	Attribute to retrieve.
+   @param ptype		Resource type to look for (if inheritance)
    @return 		value of attribute or NULL if not found
  */
-char *
-attr_value(resource_node_t *node, char *attrname)
+static char *
+_attr_value(resource_node_t *node, char *attrname, char *ptype)
 {
-	resource_t *res = node->rn_resource;
+	resource_t *res;
 	resource_attr_t *ra;
-	char *c, *p_type;
+	char *c, p_type[32];
 	ssize_t len;
 	int x;
 
+	if (!node)
+		return NULL;
+
+	res = node->rn_resource;
+
+	/* Go up the tree if it's not the right parent type */
+	if (ptype && strcmp(res->r_rule->rr_type, ptype))
+		return _attr_value(node->rn_parent, attrname, ptype);
+
 	for (x = 0; res->r_attrs && res->r_attrs[x].ra_name; x++) {
 		if (strcmp(attrname, res->r_attrs[x].ra_name))
 			continue;
@@ -108,28 +118,29 @@
 		if (!c) {
 			/* Someone doesn't care or uses older
 			   semantics on inheritance */
-			return attr_value(node->rn_parent, ra->ra_value);
+			return _attr_value(node->rn_parent, ra->ra_value,
+					   NULL);
 		}
-
-		p_type = node->rn_parent->rn_resource->r_rule->rr_type;
+		
 		len = (c - ra->ra_value);
-
-		/* Different sizes? */
-		if (strlen(p_type) != len)
-			return NULL;
-
-		/* Check for parent type match */
-		if (strncmp(p_type, ra->ra_value, len) != 0)
-			return NULL;
-
+		memset(p_type, 0, sizeof(p_type));
+		memcpy(p_type, ra->ra_value, len);
+		
 		/* Skip the "%" and recurse */
-		return attr_value(node->rn_parent, ++c);
+		return _attr_value(node->rn_parent, ++c, p_type);
 	}
 
 	return NULL;
 }
 
 
+char *
+attr_value(resource_node_t *node, char *attrname)
+{
+	return _attr_value(node, attrname, NULL);
+}
+
+
 /**
   Run to the top of the tree.  Used to determine certain attributes of the
   resource group in-line, during resource tree operations.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cluster-devel] cluster/rgmanager ChangeLog src/daemons/reslist.c
@ 2007-06-22  8:40 mgrac
  0 siblings, 0 replies; 3+ messages in thread
From: mgrac @ 2007-06-22  8:40 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	mgrac at sourceware.org	2007-06-22 08:40:20

Modified files:
	rgmanager      : ChangeLog 
	rgmanager/src/daemons: reslist.c 

Log message:
	Fix: #245171 (same patch as in #231521 for RHEL5)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.25&r2=1.5.2.26
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/reslist.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.6.2.10&r2=1.6.2.11

--- cluster/rgmanager/ChangeLog	2007/05/03 15:02:45	1.5.2.25
+++ cluster/rgmanager/ChangeLog	2007/06/22 08:40:20	1.5.2.26
@@ -1,3 +1,7 @@
+2007-06-22 Marek Grac <mgrac@redhat.com>
+	* src/daemons/reslist.c: Apply patch from Lon (same as in RHEL5) to
+	fix #245171 attr inheritance should try all direct ancestors.
+
 2007-05-03 Lon Hohberger <lhh@redhat.com>
 	* Merge patch from Crosswalk development team:
 		* Scott Cannata
--- cluster/rgmanager/src/daemons/reslist.c	2007/03/20 19:40:06	1.6.2.10
+++ cluster/rgmanager/src/daemons/reslist.c	2007/06/22 08:40:20	1.6.2.11
@@ -73,17 +73,27 @@
 
    @param node		Resource tree node to look examine
    @param attrname	Attribute to retrieve.
+   @param ptype		Resource type to look for (if inheritance)
    @return 		value of attribute or NULL if not found
  */
-char *
-attr_value(resource_node_t *node, char *attrname)
+static char *
+_attr_value(resource_node_t *node, char *attrname, char *ptype)
 {
-	resource_t *res = node->rn_resource;
+	resource_t *res;
 	resource_attr_t *ra;
-	char *c, *p_type;
+	char *c, p_type[32];
 	ssize_t len;
 	int x;
 
+	if (!node)
+		return NULL;
+
+	res = node->rn_resource;
+
+	/* Go up the tree if it's not the right parent type */
+	if (ptype && strcmp(res->r_rule->rr_type, ptype))
+		return _attr_value(node->rn_parent, attrname, ptype);
+
 	for (x = 0; res->r_attrs && res->r_attrs[x].ra_name; x++) {
 		if (strcmp(attrname, res->r_attrs[x].ra_name))
 			continue;
@@ -102,28 +112,29 @@
 		if (!c) {
 			/* Someone doesn't care or uses older
 			   semantics on inheritance */
-			return attr_value(node->rn_parent, ra->ra_value);
+			return _attr_value(node->rn_parent, ra->ra_value,
+					   NULL);
 		}
-
-		p_type = node->rn_parent->rn_resource->r_rule->rr_type;
+		
 		len = (c - ra->ra_value);
-
-		/* Different sizes? */
-		if (strlen(p_type) != len)
-			return NULL;
-
-		/* Check for parent type match */
-		if (strncmp(p_type, ra->ra_value, len) != 0)
-			return NULL;
-
+		memset(p_type, 0, sizeof(p_type));
+		memcpy(p_type, ra->ra_value, len);
+		
 		/* Skip the "%" and recurse */
-		return attr_value(node->rn_parent, ++c);
+		return _attr_value(node->rn_parent, ++c, p_type);
 	}
 
 	return NULL;
 }
 
 
+char *
+attr_value(resource_node_t *node, char *attrname)
+{
+	return _attr_value(node, attrname, NULL);
+}
+
+
 /**
   Run to the top of the tree.  Used to determine certain attributes of the
   resource group in-line, during resource tree operations.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-22  8:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-26 20:42 [Cluster-devel] cluster/rgmanager ChangeLog src/daemons/reslist.c lhh
  -- strict thread matches above, loose matches on Subject: below --
2007-06-22  8:40 mgrac
2007-04-26 20:40 lhh

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).