Skip to contentSkip to conversation

Cluster Project branch, master, updated. gfs-kernel_0_1_22-62-g53d0c18

Cluster-devel [email protected] 1 participant 1 message Mar 10, 2008

lore
Share & tools
lore
#0 lore raw

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=53d0c185cb0374ec037fdc2dd24752d07150edec

The branch, master has been updated

       via  53d0c185cb0374ec037fdc2dd24752d07150edec (commit)
      from  d596d8495b708a990a1abd599fb9ff2b282df3d1 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

- Log ----------------------------------------------------------------- commit 53d0c185cb0374ec037fdc2dd24752d07150edec

Author: Fabio M. Di Nitto <[email protected]>
Date:   Mon Mar 10 20:03:13 2008 +0100

[CCS] Fix xml -> objdb config import

-----------------------------------------------------------------------

Summary of changes:

 ccs/ccsais/config.c |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)
ccs/ccsais/config.c +24 -10
index 485a95b..1365206 100644
@@ -75,6 +75,28 @@ static struct lcr_comp ccs_comp_ver0 = {
 __attribute__ ((constructor)) static void ccs_comp_register(void) {
 	lcr_interfaces_set(&ifaces_ver0[0], &ccsconfig_iface_ver0);
 	lcr_component_register(&ccs_comp_ver0);
+};
+
+static int should_alloc(int ccs_fd, char *key)
+{
+	int keyerror, childerr;
+	char keypath[256], childpath[256];
+	char *str = NULL;
+
+	sprintf(keypath, "/cluster/%s/@*", key);
+	keyerror = ccs_get_list(ccs_fd, keypath, &str);
+	if(str)
+		free(str);
+
+	sprintf(childpath, "/cluster/%s/child::*", key);
+	childerr = ccs_get_list(ccs_fd, childpath, &str);
+	if(str)
+		free(str);
+
+	if (childerr && keyerror)
+		return 0;
+
+	return 1;
 }
 
 static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsigned int parent,
@@ -89,9 +111,9 @@ static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsigned
 	int subkeycount = 0;
 	int i;
 
-	if (always_create) {
+	if (should_alloc(ccs_fd, key) || always_create)
 		objdb->object_create(parent, &object_handle, object, strlen(object));
-	}
+
 	sprintf(path, "/cluster/%s/@*", key);
 
 	/* Get the keys */
@@ -103,10 +125,6 @@ static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsigned
 		if (error || !str)
                         break;
 
-		if (!object_handle) {
-			objdb->object_create(parent, &object_handle, object, strlen(object));
-		}
-
 		equal = strchr(str, '=');
 		if (equal)
 		{
@@ -167,10 +185,6 @@ static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsigned
 		{
 			char subpath[1024];
 
-			/* Allow for empty parents */
-			if (!object_handle)
-				object_handle = parent;
-
 			/* Found a subkey, iterate through it's sub sections */
 			sprintf(subpath, "%s/%s[%d]", key, str, ++count);
 			if (!read_config_for(ccs_fd, objdb, object_handle, str, subpath, 0))

hooks/post-receive
--
Cluster Project