rpms/cluster/F-10 fix_fence_xvmd.diff, NONE, 1.1 fix_make_args1.diff, NONE, 1.1 fix_make_args2.diff, NONE, 1.1 fix_monlist.diff, NONE, 1.1 fix_qdisk.diff, NONE, 1.1 fix_rgmanager_build1.diff, NONE, 1.1 fix_rgmanager_build2.diff, NONE, 1.1 fix_rgmanager_build3.diff, NONE, 1.1 fix_shell_quoting.diff, NONE, 1.1 fix_smb.diff, NONE, 1.1 fix_xmlloader1.diff, NONE, 1.1 fix_xmlloader2.diff, NONE, 1.1 cluster.spec, 1.25, 1.26

Fabio M. Di Nitto fabbione at fedoraproject.org
Fri Nov 21 07:40:23 UTC 2008


Author: fabbione

Update of /cvs/pkgs/rpms/cluster/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7817

Modified Files:
	cluster.spec 
Added Files:
	fix_fence_xvmd.diff fix_make_args1.diff fix_make_args2.diff 
	fix_monlist.diff fix_qdisk.diff fix_rgmanager_build1.diff 
	fix_rgmanager_build2.diff fix_rgmanager_build3.diff 
	fix_shell_quoting.diff fix_smb.diff fix_xmlloader1.diff 
	fix_xmlloader2.diff 
Log Message:
Fix several issues that have been recently uncovered by users


fix_fence_xvmd.diff:

--- NEW FILE fix_fence_xvmd.diff ---
commit b261df009c8d5ec513f8dc4befecf400e44d9237
Author: Lon Hohberger <lhh at redhat.com>
Date:   Fri Nov 7 09:58:29 2008 -0500

    [fence] Make fence_xvmd "reboot" work with newer versions of libvirt

diff --git a/fence/agents/xvm/fence_xvmd.c b/fence/agents/xvm/fence_xvmd.c
index f656680..1eedc08 100644
--- a/fence/agents/xvm/fence_xvmd.c
+++ b/fence/agents/xvm/fence_xvmd.c
@@ -220,7 +220,7 @@ do_fence_request_tcp(fence_req_t *req, fence_auth_type_t auth,
 		     int flags)
 {
 	int fd = -1, ret = -1;
-	virDomainPtr vdp;
+	virDomainPtr vdp = NULL, nvdp = NULL;
 	virDomainInfo vdi;
 	char response = 1;
 	char *domain_desc, *domain_desc_sanitized;
@@ -329,9 +329,22 @@ do_fence_request_tcp(fence_req_t *req, fence_auth_type_t auth,
 				   (char *)req->domain);
 		} else if (domain_desc) {
 			/* Recreate the domain if possible */
-			/* Success */
+			/* Success... or not? */
 			dbg_printf(2, "Calling virDomainCreateLinux()...\n");
-			virDomainCreateLinux(vp, domain_desc, 0);
+			nvdp = virDomainCreateLinux(vp, domain_desc, 0);
+
+			if (nvdp == NULL) {
+				/* More recent versions of libvirt or perhaps the
+ 				   KVM back-end do not let you create a domain from
+ 				   XML if there is already a defined domain description
+ 				   with the same name that it knows about.  You must
+ 				   then call virDomainCreate() */
+				dbg_printf(2, "Failed; Trying virDomainCreate()...\n");
+				if (virDomainCreate(vdp) < 0) {
+					log_printf(LOG_ERR, "Failed to recreate guest"
+						   " %s!\n", (char *)req->domain);
+				}
+			}
 			free(domain_desc);
 		}
 		break;
@@ -343,6 +356,10 @@ do_fence_request_tcp(fence_req_t *req, fence_auth_type_t auth,
 			   strerror(errno));
 	}
 out:
+	if (vdp)
+		virDomainFree(vdp);
+	if (nvdp)
+		virDomainFree(nvdp);
 	if (fd != -1)
 		close(fd);
 

fix_make_args1.diff:

--- NEW FILE fix_make_args1.diff ---
commit 69b3ecac8da9ce4a34efb6702b253e52ea87e063
Author: Ryan McCabe <rmccabe at redhat.com>
Date:   Fri Nov 7 16:33:20 2008 -0500

    libfence: whitespace cleanup

diff --git a/fence/libfence/agent.c b/fence/libfence/agent.c
index f06ff6a..3454ec7 100644
--- a/fence/libfence/agent.c
+++ b/fence/libfence/agent.c
@@ -15,11 +15,11 @@
 #define MAX_DEVICES		8
 #define MAX_AGENT_ARGS_LEN	512
 
-#define METHOD_NAME_PATH        "/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[%d]/@name"
-#define DEVICE_NAME_PATH        "/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[@name=\"%s\"]/device[%d]/@name"
-#define NODE_FENCE_ARGS_PATH    "/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[@name=\"%s\"]/device[%d]/@*"
-#define AGENT_NAME_PATH         "/cluster/fencedevices/fencedevice[@name=\"%s\"]/@agent"
-#define FENCE_DEVICE_ARGS_PATH  "/cluster/fencedevices/fencedevice[@name=\"%s\"]/@*"
+#define METHOD_NAME_PATH		"/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[%d]/@name"
+#define DEVICE_NAME_PATH		"/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[@name=\"%s\"]/device[%d]/@name"
+#define NODE_FENCE_ARGS_PATH	"/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[@name=\"%s\"]/device[%d]/@*"
+#define AGENT_NAME_PATH			"/cluster/fencedevices/fencedevice[@name=\"%s\"]/@agent"
+#define FENCE_DEVICE_ARGS_PATH	"/cluster/fencedevices/fencedevice[@name=\"%s\"]/@*"
 
 
 
@@ -57,17 +57,17 @@ static int run_agent(char *agent, char *args)
 
 	if (pipe(fd1))
 		goto fail;
-  	pr_fd = fd1[0];
-  	cw_fd = fd1[1];
+	pr_fd = fd1[0];
+	cw_fd = fd1[1];
 
-  	if (pipe(fd2))
-   		goto fail;
-  	cr_fd = fd2[0];
-  	pw_fd = fd2[1];
+	if (pipe(fd2))
+		goto fail;
+	cr_fd = fd2[0];
+	pw_fd = fd2[1];
 
 	pid = fork();
 	if (pid < 0)
-   		goto fail;
+		goto fail;
 
 	if (pid) {
 		/* parent */
@@ -125,7 +125,7 @@ static int run_agent(char *agent, char *args)
 }
 
 static int make_args(int cd, char *victim, char *method, int d,
-		     char *device, char **args_out)
+				char *device, char **args_out)
 {
 	char path[256], *args, *str;
 	int error;
@@ -249,7 +249,7 @@ static int count_devices(int cd, char *victim, char *method)
 }
 
 static int use_device(int cd, char *victim, char *method, int d,
-		      char *device)
+				char *device)
 {
 	char path[256], *agent, *args = NULL;
 	int error;
@@ -306,9 +306,8 @@ int fence_node(char *victim)
 				sleep(1);
 			
 			error = get_method(cd, victim, m, &method);
-
-		if (error)
-			continue;
+			if (error)
+				continue;
 		} else if (error)
 			continue;
 
@@ -344,4 +343,3 @@ int fence_node(char *victim)
 
 	return error;
 }
-

fix_make_args2.diff:

--- NEW FILE fix_make_args2.diff ---
commit 3de140ad461dadfd99eadd4d37bc9d53ffd1b741
Author: Lon Hohberger <lhh at redhat.com>
Date:   Fri Nov 7 17:33:20 2008 -0500

    fence: Fix bug in make_args()
    
    A bug in make_args() caused it  to always return an error code,
    even if we formulated a perfectly good set of arguments.
    
    Basically, eventually ccs_get_list returns -1 when all items are
    exhausted, so the check at the bottom of the function would free
    any arguments we had (correctly) set up and return an error code,
    thereby avoiding actually calling the agent.

diff --git a/fence/libfence/agent.c b/fence/libfence/agent.c
index 3454ec7..c04df17 100644
--- a/fence/libfence/agent.c
+++ b/fence/libfence/agent.c
@@ -128,7 +128,7 @@ static int make_args(int cd, char *victim, char *method, int d,
 				char *device, char **args_out)
 {
 	char path[256], *args, *str;
-	int error;
+	int error, cnt = 0;
 
 	args = malloc(MAX_AGENT_ARGS_LEN);
 	if (!args)
@@ -144,6 +144,7 @@ static int make_args(int cd, char *victim, char *method, int d,
 		error = ccs_get_list(cd, path, &str);
 		if (error || !str)
 			break;
+		++cnt;
 
 		if (!strncmp(str, "name=", 5)) {
 			free(str);
@@ -164,6 +165,7 @@ static int make_args(int cd, char *victim, char *method, int d,
 		error = ccs_get_list(cd, path, &str);
 		if (error || !str)
 			break;
+		++cnt;
 
 		if (!strncmp(str, "name=", 5)) {
 			free(str);
@@ -175,6 +177,8 @@ static int make_args(int cd, char *victim, char *method, int d,
 		free(str);
 	}
 
+	if (cnt)
+		error = 0;
 	if (error) {
 		free(args);
 		args = NULL;

fix_monlist.diff:

--- NEW FILE fix_monlist.diff ---
commit 90c6340891ae9bffd09f3a2e31a1d10b3dda8200
Author: Jan Friesse <jfriesse at redhat.com>
Date:   Tue Nov 4 11:32:11 2008 +0100

    fence: Fix operation 'list' and 'monitor' for LDOM and ePowerSwitch
    
    This two fence agents had same method for getting power status
    and getting outlets. In method was simple checking, which
    operation should be processed, but main fencing library doesn't
    set this option to 'status' in case of powering outlet on or off.
    
    This led to bad behaviour in case of on, off and reboot operation.
    Operations status, list and monitor wasn't affected.

diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index c56ffb8..921487b 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -73,7 +73,7 @@ def get_power_status(conn, options):
 	for out_num,out_stat in status:
 		result[out_num]=("",(out_stat=="1" and "on" or "off"))
 
-	if (options["-o"] == "status"):
+	if (not (options["-o"] in ['monitor','list'])):
 		if (not (options["-n"] in result)):
 			fail_usage("Failed: You have to enter existing physical plug!")
 		else:
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index 78771c6..390d072 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -57,7 +57,7 @@ def get_power_status(conn, options):
 	except pexpect.TIMEOUT:
 		fail(EC_TIMED_OUT)
 
-	if (options["-o"] == "status"):
+	if (not (options["-o"] in ['monitor','list'])):
 		if (not (options["-n"] in result)):
 			fail_usage("Failed: You have to enter existing logical domain!")
 		else:

fix_qdisk.diff:

--- NEW FILE fix_qdisk.diff ---
commit 968d2218fec8b29e4a6f3a6db70a0dd9f8e6aff3
Author: Lon Hohberger <lhh at redhat.com>
Date:   Fri Nov 7 12:53:51 2008 -0500

    qdisk: fix block size check
    
    When using device="" instead of label="", this check was causing
    qdiskd to incorrectly exit.
    
    Resolves: #470533

diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index df5b804..4dbe511 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -1646,12 +1646,13 @@ main(int argc, char **argv)
 		}
 
 		if (qh.qh_version == VERSION_MAGIC_V2 &&
-                    qh.qh_blksz != rv) {
+		    qh.qh_blksz != qh.qh_kernsz) {
 			log_printf(LOG_CRIT,
-			       "Specified device %s does match kernel's "
-			       "reported sector size (%lu != %d)\n",
+			       "Specified device %s does not match kernel's "
+			       "reported sector size (%lu != %lu)\n",
 			       ctx.qc_device,
-			       (unsigned long)ctx.qc_disk.d_blksz, rv);
+			       (unsigned long)qh.qh_blksz,
+			       (unsigned long)qh.qh_kernsz);
 			check_stop_cman(&ctx);
 			goto out;
 		}

fix_rgmanager_build1.diff:

--- NEW FILE fix_rgmanager_build1.diff ---
commit a1e4a327cb4f605301b4c28249f1ce7e0e82f4bd
Author: Lon Hohberger <lhh at redhat.com>
Date:   Mon Nov 10 12:53:47 2008 -0500

    rgmanager: Use CCS again instead of building everything NO_CCS

diff --git a/make/cobj.mk b/make/cobj.mk
index b484f6b..a009927 100644
--- a/make/cobj.mk
+++ b/make/cobj.mk
@@ -7,7 +7,7 @@
 
 # used by rgmanager/src/daemons
 %-noccs.o: $(S)/%.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(NOCCS_CFLAGS) -c -o $@ $<
 
 # used by fence/agents/xvm
 %-standalone.o: $(S)/%.c
diff --git a/rgmanager/src/daemons/Makefile b/rgmanager/src/daemons/Makefile
index df07aab..22d55b0 100644
--- a/rgmanager/src/daemons/Makefile
+++ b/rgmanager/src/daemons/Makefile
@@ -53,7 +53,7 @@ CFLAGS += `xml2-config --cflags` -I${readlineincdir} -I${slangincdir}
 CFLAGS += -I$(S)/../../include
 CFLAGS += -I${incdir}
 
-EXTRA_CFLAGS += -DNO_CCS
+NOCCS_CFLAGS += -DNO_CCS
 
 LDFLAGS += -L../clulib -lclulib
 LDFLAGS += -L${libdir}

fix_rgmanager_build2.diff:

--- NEW FILE fix_rgmanager_build2.diff ---
commit 7dce3c5d39a405bbd0843da25808a6891eb96cfb
Author: Fabio M. Di Nitto <fdinitto at redhat.com>
Date:   Mon Nov 10 19:03:57 2008 +0100

    build: respect build: respect EXTRA_CFLAGS in cobj.mk
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>

diff --git a/make/cobj.mk b/make/cobj.mk
index a009927..03f1826 100644
--- a/make/cobj.mk
+++ b/make/cobj.mk
@@ -7,7 +7,7 @@
 
 # used by rgmanager/src/daemons
 %-noccs.o: $(S)/%.c
-	$(CC) $(CFLAGS) $(NOCCS_CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(NOCCS_CFLAGS) -c -o $@ $<
 
 # used by fence/agents/xvm
 %-standalone.o: $(S)/%.c

fix_rgmanager_build3.diff:

--- NEW FILE fix_rgmanager_build3.diff ---
commit dac43684552535cbdb8146d667d6ebca37575b55
Author: Lon Hohberger <lhh at redhat.com>
Date:   Mon Nov 10 13:09:33 2008 -0500

    rgmanager: Fix debug build error

diff --git a/rgmanager/src/daemons/fo_domain.c b/rgmanager/src/daemons/fo_domain.c
index f934e38..09acd22 100644
--- a/rgmanager/src/daemons/fo_domain.c
+++ b/rgmanager/src/daemons/fo_domain.c
@@ -462,7 +462,8 @@ node_should_start(int nodeid, cluster_member_list_t *membership,
 		 */
 #ifdef DEBUG
 		log_printf(LOG_DEBUG,
-		       "Fail-over Domain for service %d nonexistent\n");
+		       "Fail-over Domain for service %s nonexistent\n",
+		       rg_name);
 #endif
 		return FOD_BEST;
 	}

fix_shell_quoting.diff:

--- NEW FILE fix_shell_quoting.diff ---
commit 99572c2e8e90f8382fecb49c51efcf6567d9e6d6
Author: Ryan O'Hara <rohara at redhat.com>
Date:   Thu Nov 6 14:18:24 2008 -0600

    BZ 453429: Fix conditional check of $OCF_RESKEY_migration_mapping
    to be double quoted.

diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
index e72cbbb..07561d0 100644
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -503,7 +503,7 @@ migrate()
 
 	# Patch from Marcelo Azevedo to migrate over private
 	# LANs instead of public LANs
-        if [ -n $OCF_RESKEY_migration_mapping ] ; then
+        if [ -n "$OCF_RESKEY_migration_mapping" ] ; then
                 target=${OCF_RESKEY_migration_mapping#*$target:} target=${target%%,*}
         fi
 

fix_smb.diff:

--- NEW FILE fix_smb.diff ---
commit a7386f7673d23e37dfe763669ca76ac8fe5e4443
Author: Fabio M. Di Nitto <fdinitto at redhat.com>
Date:   Fri Oct 31 13:08:59 2008 +0100

    rgmanager: Fix smb.sh shell scripting
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>

diff --git a/rgmanager/src/resources/smb.sh b/rgmanager/src/resources/smb.sh
index c344ceb..c2a9d9d 100644
--- a/rgmanager/src/resources/smb.sh
+++ b/rgmanager/src/resources/smb.sh
@@ -266,7 +266,7 @@ add_sha1()
 
 verify_sha1()
 {
-	declare tmpfile="$(mktemp /tmp/smb-${OCF_RESKEY}_name.tmp.XXXXXX)"
+	declare tmpfile="$(mktemp /tmp/smb-$OCF_RESKEY_name.tmp.XXXXXX)"
 	declare current exp
 
 	exp=$(grep "^# rgmanager-sha1.*$1" "$1" | head -1)

fix_xmlloader1.diff:

--- NEW FILE fix_xmlloader1.diff ---
commit bd261c8e51f3b5406f22bbb00b76f6da8722412d
Author: Fabio M. Di Nitto <fdinitto at redhat.com>
Date:   Tue Nov 11 06:35:45 2008 +0100

    config: fix loading of multiple objects with no subojects
    
    libxml returns a different value for <foo/> depending if foo has
    child entries or not.
    
    Use a bit of string magic to use the return value always in the same
    way.
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>

diff --git a/config/plugins/xml/Makefile b/config/plugins/xml/Makefile
index 7e0f147..b95d005 100644
--- a/config/plugins/xml/Makefile
+++ b/config/plugins/xml/Makefile
@@ -10,7 +10,7 @@ include $(OBJDIR)/make/clean.mk
 include $(OBJDIR)/make/install.mk
 include $(OBJDIR)/make/uninstall.mk
 
-CFLAGS += -fPIC
+CFLAGS += -fPIC -D_GNU_SOURCE
 CFLAGS += `xml2-config --cflags`
 CFLAGS += -I${cmanincdir}/../daemon
 CFLAGS += -I${incdir}
diff --git a/config/plugins/xml/config.c b/config/plugins/xml/config.c
index 9813451..50a9172 100644
--- a/config/plugins/xml/config.c
+++ b/config/plugins/xml/config.c
@@ -211,14 +211,14 @@ static int read_config_for(xmlXPathContextPtr ctx, struct objdb_iface_ver0 *objd
 		ret++;
 
 		if(!prevstr) {
-			prevstr = strdup(str);
+			prevstr = strndup(str, (strstr(str, "=") - str));
 		} else {
-			if(!strcmp(str, prevstr)) {
+			if(!strncmp(str, prevstr, (strstr(str, "=") - str))) {
 				nodecount++;
 			} else {
 				nodecount = 1;
 				free(prevstr);
-				prevstr = strdup(str);
+				prevstr = strndup(str, (strstr(str, "=") - str));
 			}
 		}
 

fix_xmlloader2.diff:

--- NEW FILE fix_xmlloader2.diff ---
commit 08ad05091ab2b390feb68944e46ffbcb12cec247
Author: Fabio M. Di Nitto <fdinitto at redhat.com>
Date:   Wed Nov 19 11:30:46 2008 +0100

    xmlconfig: major rework
    
    cleanup completely our dependency on xpath.
    
    use XML internal data structure to get objects and keys associated to
    objects.
    
    speed up the whole config load time a lot.
    
    remote completely all exception handling that's now done using xml data
    instead.
    
    considerably reduce the amount of memory required to load the config.
    
    cleanup other bits (drop unrequired includes and invoke some XML cleanup
    code).
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>

diff --git a/config/plugins/xml/config.c b/config/plugins/xml/config.c
index 50a9172..9da448b 100644
--- a/config/plugins/xml/config.c
+++ b/config/plugins/xml/config.c
@@ -1,12 +1,7 @@
 #include <string.h>
-#include <limits.h>
 #include <syslog.h>
-#include <arpa/inet.h>
 
-#include <libxml/parser.h>
 #include <libxml/tree.h>
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
 
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/engine/objdb.h>
@@ -15,8 +10,10 @@
 #include "logging.h"
 
 static int xml_readconfig(struct objdb_iface_ver0 *objdb, char **error_string);
-static int xml_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, char **error_string);
-static int init_config(struct objdb_iface_ver0 *objdb, char *configfile, char *error_string);
+static int xml_reloadconfig(struct objdb_iface_ver0 *objdb, int flush,
+			    char **error_string);
+static int init_config(struct objdb_iface_ver0 *objdb, char *configfile,
+		       char *error_string);
 static char error_reason[1024];
 
 #define DEFAULT_CONFIG DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE
@@ -26,235 +23,71 @@ static char error_reason[1024];
  */
 
 static struct config_iface_ver0 xmlconfig_iface_ver0 = {
-	.config_readconfig        = xml_readconfig,
-	.config_reloadconfig      = xml_reloadconfig
+	.config_readconfig = xml_readconfig,
+	.config_reloadconfig = xml_reloadconfig
 };
 
 static struct lcr_iface ifaces_ver0[2] = {
 	{
-		.name		       	= "xmlconfig",
-		.version	       	= 0,
-		.versions_replace      	= 0,
-		.versions_replace_count	= 0,
-		.dependencies	       	= 0,
-		.dependency_count      	= 0,
-		.constructor	       	= NULL,
-		.destructor	       	= NULL,
-		.interfaces	       	= NULL,
-	}
+	 .name = "xmlconfig",
+	 .version = 0,
+	 .versions_replace = 0,
+	 .versions_replace_count = 0,
+	 .dependencies = 0,
+	 .dependency_count = 0,
+	 .constructor = NULL,
+	 .destructor = NULL,
+	 .interfaces = NULL,
+	 }
 };
 
 static struct lcr_comp xml_comp_ver0 = {
-	.iface_count				= 1,
-	.ifaces					= ifaces_ver0,
+	.iface_count = 1,
+	.ifaces = ifaces_ver0,
 };
 
-__attribute__ ((constructor)) static void xml_comp_register(void) {
+__attribute__ ((constructor))
+static void xml_comp_register(void)
+{
 	lcr_interfaces_set(&ifaces_ver0[0], &xmlconfig_iface_ver0);
 	lcr_component_register(&xml_comp_ver0);
 };
 
-static char *do_xml_query(xmlXPathContextPtr ctx, char *query, char **previous_query, int *xmllistindex, int list) {
-	xmlXPathObjectPtr obj = NULL;
-	xmlNodePtr node = NULL;
-	char *rtn = NULL;
-	int size = 0, nnv = 0, child = 0;
-
-	if (list && !strcmp(query, *previous_query)) {
-		*xmllistindex = *xmllistindex + 1;
-	} else {
-		memset(*previous_query, 0, PATH_MAX);
-		*xmllistindex = 0;
-	}
-
-	obj = xmlXPathEvalExpression((xmlChar *)query, ctx);
-	if (obj && obj->nodesetval && (obj->nodesetval->nodeNr > 0)) {
-		if (*xmllistindex >= obj->nodesetval->nodeNr) {
-			memset(*previous_query, 0, PATH_MAX);
-			*xmllistindex = 0;
-			goto fail;
-		}
-
-		node = obj->nodesetval->nodeTab[*xmllistindex];
-		if (!node)
-			goto fail;
-
-		if (((node->type == XML_ATTRIBUTE_NODE) && strstr(query, "@*")) ||
-		     ((node->type == XML_ELEMENT_NODE) && strstr(query, "child::*"))) {
-			if (node->children && node->children->content) {
-				size = strlen((char *)node->children->content) +
-					strlen((char *)node->name)+2;
-				child = 1;
-			} else
-				size = strlen((char *)node->name)+2;
-
-			nnv = 1;
-		} else {
-			if (node->children && node->children->content)
-				size = strlen((char *)node->children->content)+1;
-			else
-				goto fail;
-		}
-
-		rtn = malloc(size);
-		if (!rtn)
-			goto fail;
-
-		memset(rtn, 0, size);
-
-		if (nnv) {
-			if (child)
-				sprintf(rtn, "%s=%s", node->name, (char *)node->children->content);
-			else
-				sprintf(rtn, "%s=", node->name);
-		} else
-			sprintf(rtn, "%s", node->children ? node->children->content : node->name);
-
-		if(list)
-			strncpy(*previous_query, query, PATH_MAX-1);
-	}
-
-fail:
-	if (obj)
-		xmlXPathFreeObject(obj);
-
-	return rtn;
-}
-
-static int should_alloc(xmlXPathContextPtr ctx, char *key)
+static void addkeys(xmlAttrPtr tmpattr, struct objdb_iface_ver0 *objdb,
+		    unsigned int object_handle)
 {
-	int keyerror = 1, childerr = 1;
-	char path[256];
-	char previous_query_local[PATH_MAX];
-	char *previous_query = previous_query_local;
-	int xmllistindex = 0;
-	char *str = NULL;
-
-	memset(previous_query, 0, PATH_MAX);
-	sprintf(path, "%s/@*", key);
-	str = do_xml_query(ctx, path, &previous_query, &xmllistindex, 1);
-	if (str) {
-		keyerror = 0;
-		free(str);
-		str = NULL;
-	}
-
-	memset(previous_query, 0, PATH_MAX);
-	sprintf(path, "%s/child::*", key);
-	str = do_xml_query(ctx, path, &previous_query, &xmllistindex, 1);
-	if(str) {
-		childerr = 0;
-		free(str);
-		str = NULL;
+	for (tmpattr = tmpattr; tmpattr; tmpattr = tmpattr->next) {
+		if (tmpattr->type == XML_ATTRIBUTE_NODE)
+			objdb->object_key_create(object_handle,
+						 (char *)tmpattr->name,
+						 strlen((char *)tmpattr->name),
+						 (char *)tmpattr->children->
+						 content,
+						 strlen((char *)tmpattr->
+							children->content) + 1);
 	}
-
-	if (childerr && keyerror)
-		return 0;
-
-	return 1;
 }
 
-static int read_config_for(xmlXPathContextPtr ctx, struct objdb_iface_ver0 *objdb, unsigned int parent,
-			   char *object, char *key, int always_create)
+static void xml2objdb(xmlNodePtr tmpnode, struct objdb_iface_ver0 *objdb,
+		      unsigned int parent)
 {
-	char *str, *prevstr = NULL;
 	unsigned int object_handle = 0;
-	char path[PATH_MAX];
-	char previous_query_local[PATH_MAX];
-	char *previous_query = previous_query_local;
-	int xmllistindex = 0;
-	int ret = 0;
-	int nodecount = 1;
-
-	if (should_alloc(ctx, key) || always_create) {
-		objdb->object_create(parent, &object_handle, object, strlen(object));
-	}
-
-	memset(previous_query, 0, PATH_MAX);
-	sprintf(path, "%s/@*", key);
-	/* Get the keys */
-	for (;;)
-	{
-		char *equal;
-
-		str = do_xml_query(ctx, path, &previous_query, &xmllistindex, 1);
-		if (!str)
-                        break;
-
-		ret++;
 
-		equal = strchr(str, '=');
-		if (equal)
-		{
-			*equal = 0;
-			objdb->object_key_create(object_handle, str, strlen(str),
-						 equal+1, strlen(equal+1)+1);
+	for (tmpnode = tmpnode; tmpnode; tmpnode = tmpnode->next) {
+		if (tmpnode->type == XML_ELEMENT_NODE) {
+			objdb->object_create(parent, &object_handle,
+					     (char *)tmpnode->name,
+					     strlen((char *)tmpnode->name));
+			if (tmpnode->properties)
+				addkeys(tmpnode->properties, objdb,
+					object_handle);
 		}
-		free(str);
+		xml2objdb(tmpnode->children, objdb, object_handle);
 	}
-
-	/* Now look for sub-objects.
-	   CCS can't cope with recursive queries so we have to store the result of
-	   the subkey search */
-	memset(previous_query, 0, PATH_MAX);
-	xmllistindex = 0;
-	sprintf(path, "%s/child::*", key);
-	for (;;)
-	{
-		char *equal;
-		char subpath[PATH_MAX];
-
-		str = do_xml_query(ctx, path, &previous_query, &xmllistindex, 1);
-		if (!str)
-                        break;
-
-		ret++;
-
-		if(!prevstr) {
-			prevstr = strndup(str, (strstr(str, "=") - str));
-		} else {
-			if(!strncmp(str, prevstr, (strstr(str, "=") - str))) {
-				nodecount++;
-			} else {
-				nodecount = 1;
-				free(prevstr);
-				prevstr = strndup(str, (strstr(str, "=") - str));
-			}
-		}
-
-		/* CCS returns duplicate values for the numbered entries we use below.
-		   eg. if there are 4 <clusternode/> entries it will return
-		     clusternode=
-		     clusternode=
-		     clusternode=
-		     clusternode=
-		   which is not helpful to us cos we retrieve them as
-		     clusternode[1]
-		     clusternode[2]
-		     clusternode[3]
-		     clusternode[4]
-		   so we just store unique keys.
-		*/
-		equal = strchr(str, '=');
-		if (equal)
-			*equal = 0;
-
-		memset(subpath, 0, PATH_MAX);
-
-		/* Found a subkey, iterate through it's sub sections */
-		sprintf(subpath, "%s/%s[%d]", key, str, nodecount);
-		if (!read_config_for(ctx, objdb, object_handle, str, subpath, 0)) {
-			free(str);
-			break;
-		}
-
-		free(str);
-	}
-
-	return ret;
 }
 
-static int xml_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, char **error_string)
+static int xml_reloadconfig(struct objdb_iface_ver0 *objdb, int flush,
+			    char **error_string)
 {
 	return xml_readconfig(objdb, error_string);
 }
@@ -265,28 +98,30 @@ static int xml_readconfig(struct objdb_iface_ver0 *objdb, char **error_string)
 	char *configfile = DEFAULT_CONFIG;
 
 	/* We need to set this up to internal defaults too early */
-	openlog("corosync", LOG_CONS|LOG_PID, SYSLOGFACILITY);
+	openlog("corosync", LOG_CONS | LOG_PID, SYSLOGFACILITY);
 
-	if(getenv("COROSYNC_CLUSTER_CONFIG_FILE"))
+	if (getenv("COROSYNC_CLUSTER_CONFIG_FILE"))
 		configfile = getenv("COROSYNC_CLUSTER_CONFIG_FILE");
 
 	/* Read low-level totem/aisexec etc config from cluster.conf */
-	if ( !(ret = init_config(objdb, configfile, error_reason)) )
-		sprintf (error_reason, "Successfully read config from %s\n", configfile);
+	if (!(ret = init_config(objdb, configfile, error_reason)))
+		sprintf(error_reason, "Successfully read config from %s\n",
+			configfile);
 	else
-		sprintf (error_reason, "Unable to read config from %s\n", configfile);
+		sprintf(error_reason, "Unable to read config from %s\n",
+			configfile);
 
-        *error_string = error_reason;
+	*error_string = error_reason;
 
 	return ret;
 }
 
-
-static int init_config(struct objdb_iface_ver0 *objdb, char *configfile, char *error_string)
+static int init_config(struct objdb_iface_ver0 *objdb, char *configfile,
+		       char *error_string)
 {
 	int err = 0;
 	xmlDocPtr doc = NULL;
-	xmlXPathContextPtr ctx = NULL;
+	xmlNodePtr root_node = NULL;
 
 	/* openfile */
 
@@ -296,22 +131,20 @@ static int init_config(struct objdb_iface_ver0 *objdb, char *configfile, char *e
 		goto fail;
 	}
 
-	ctx = xmlXPathNewContext(doc);
-	if (!ctx) {
+	root_node = xmlDocGetRootElement(doc);
+	if (!root_node) {
 		err = -1;
 		goto fail;
 	}
 
 	/* load it in objdb */
-	read_config_for(ctx, objdb, OBJECT_PARENT_HANDLE, "cluster", "/cluster", 1);
+	xml2objdb(root_node, objdb, OBJECT_PARENT_HANDLE);
 
 fail:
-
-	if (ctx)
-		xmlXPathFreeContext(ctx);
-
 	if (doc)
 		xmlFreeDoc(doc);
 
+	xmlCleanupParser();
+
 	return err;
 }


Index: cluster.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cluster/F-10/cluster.spec,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- cluster.spec	3 Nov 2008 15:18:02 -0000	1.25
+++ cluster.spec	21 Nov 2008 07:40:19 -0000	1.26
@@ -19,11 +19,23 @@
 Name: cluster
 Summary: Red Hat Cluster
 Version: 2.99.12
-Release: 1%{?alphatag:.%{alphatag}}%{?dist}
+Release: 2%{?alphatag:.%{alphatag}}%{?dist}
 License: GPLv2+ and LGPLv2+
 Group: System Environment/Base
 URL: http://sources.redhat.com/cluster/wiki/
 Source0: ftp://sources.redhat.com/pub/cluster/releases/cluster-%{version}.tar.gz
+Patch0: fix_fence_xvmd.diff
+Patch1: fix_make_args2.diff
+Patch2: fix_monlist.diff
+Patch3: fix_qdisk.diff
+Patch4: fix_rgmanager_build1.diff
+Patch5: fix_rgmanager_build2.diff
+Patch6: fix_rgmanager_build3.diff
+Patch7: fix_shell_quoting.diff
+Patch8: fix_smb.diff
+Patch9: fix_xmlloader1.diff
+Patch10: fix_xmlloader2.diff
+Patch11: fix_make_args1.diff
 
 ## Setup/build bits
 
@@ -48,6 +60,18 @@
 
 %prep
 %setup -q -n cluster-%{version}
+%patch0 -p1
+%patch11 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
 
 %build
 # for legacy reasons, all binaries have always been installed in /sbin
@@ -340,6 +364,17 @@
 %{_mandir}/man8/gnbd*
 
 %changelog
+* Fri Nov 21 2008 Fabio M. Di Nitto <fdinitto at redhat.com> - 2.99.12-2
+- import several important fixes from upstream.
+- fix_fence_xvmd: make fence xvmd work with recent versions of libvirt
+- fix_make_args*: handle correctly args to fence agents
+- fix_monlist: make LDOM and ePowerSwitch agents work
+- fix_qdisk: make qdisk work again when device= is used in config.
+- fix_rgmanager_build*: rgmanager was not build correctly due to a CFLAGS leak.
+- fix_shell_quoting: fix quoting of OCF variable.
+- fix_smb: fix small (user invisible) regression.
+- fix_xmlloader*: fix severe regression in xml parsing.
+
 * Mon Nov  3 2008 Fabio M. Di Nitto <fdinitto at redhat.com> - 2.99.12-1
 - new upstream release.
   Fix several security related issues.




More information about the fedora-extras-commits mailing list