[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/fence/agents/xvm Makefile fence_xvmd.c ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	lhh sourceware org	2007-06-26 17:17:40

Modified files:
	fence/agents/xvm: Makefile fence_xvmd.c 
Added files:
	fence/agents/xvm: xml.c 
	fence/agents/xvm/tests: hvm.xml linux.xml 

Log message:
	Fix full-virt rebooting (#243872)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/xml.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.2&r2=1.3.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/fence_xvmd.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.4&r2=1.4.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/tests/hvm.xml.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/tests/linux.xml.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1

--- cluster/fence/agents/xvm/Makefile	2006/11/13 20:50:34	1.3.2.2
+++ cluster/fence/agents/xvm/Makefile	2007/06/26 17:17:40	1.3.2.3
@@ -18,19 +18,20 @@
 fence_xvm_SOURCE = fence_xvm.c mcast.c ip_lookup.c simple_auth.c tcp.c \
 		   options.c debug.c
 fence_xvmd_SOURCE= fence_xvmd.c mcast.c simple_auth.c tcp.c virt.c \
-		   options.c options-ccs.c vm_states.c debug.c
+		   options.c options-ccs.c vm_states.c debug.c \
+		   xml.c
 
 
 INCLUDE=-I${top_srcdir}/include -I${top_srcdir}/config \
 	-I/usr/include/openais -I/usr/include/libvirt \
 	-I/usr/include/nss3 -I/usr/include/nspr4 \
-	-I../../../cman/lib -I../../../ccs/lib
+	-I../../../cman/lib -I../../../ccs/lib -I/usr/include/libxml2
 
 CFLAGS+=-DFENCE_RELEASE_NAME=\"${RELEASE}\" \
 	-Wall -Werror -Wstrict-prototypes -Wshadow -ggdb -D_GNU_SOURCE
 
 LIBS+=-L../../../cman/lib -L../../../ccs/lib -L${libdir}/openais \
-      -L../../../dlm/lib -lnss3
+      -L../../../dlm/lib -lnss3 -lxml2
 
 all: ${TARGETS}
 
@@ -46,6 +47,10 @@
 clean:
 	rm -f $(TARGETS) *~ *.o
 
+testprog:
+	 gcc -o testprog xml.c -I/usr/include/libxml2 -lxml2 \
+		 -DSTANDALONE -ggdb
+
 install: all
 	if [ ! -d ${sbindir} ]; then \
 		install -d ${sbindir}; \
--- cluster/fence/agents/xvm/fence_xvmd.c	2007/01/10 20:25:58	1.4.2.4
+++ cluster/fence/agents/xvm/fence_xvmd.c	2007/06/26 17:17:40	1.4.2.5
@@ -55,6 +55,9 @@
 
 static int running = 1;
 
+
+int cleanup_xml(char *xmldesc, char **ret, size_t *retsz);
+
 int
 connect_tcp(fence_req_t *req, fence_auth_type_t auth,
 	    void *key, size_t key_len)
@@ -165,48 +168,6 @@
 }
 
 
-/*
-   Nuke the OS block if this domain was booted using a bootloader.
-   XXX We probably should use libxml2 to do this, but this is very fast
- */
-void
-cleanup_xmldesc(char *xmldesc)
-{
-	char *start = NULL;
-	char *end = NULL;
-
-#define STARTBOOTTAG "<bootloader>"
-#define ENDBOOTTAG   "</bootloader>"
-#define STARTOSTAG   "<os>"
-#define ENDOSTAG     "</os>"
-
-	/* Part 1: Check for a boot loader */
-	start = strcasestr(xmldesc, STARTBOOTTAG);
-	if (start) {
-		start += strlen(STARTBOOTTAG);
-		end = strcasestr(start, ENDBOOTTAG);
-		if (end == start) {
-			/* Empty bootloader tag -> return */
-			return;
-		}
-	}
-
-	/* Part 2: Nuke the <os> tag */
-	start = strcasestr(xmldesc, STARTOSTAG);
-	if (!start)
-		return;
-	end = strcasestr(start, ENDOSTAG);
-	if (!end)
-		return;
-	end += strlen(ENDOSTAG);
-
-	dprintf(3, "Clearing %d bytes starting @ %p\n", (int)(end-start),
-		start);
-
-	memset(start, ' ', end-start);
-}
-
-
 static inline int
 wait_domain(fence_req_t *req, virConnectPtr vp, int timeout)
 {
@@ -262,7 +223,8 @@
 	int fd, ret = -1;
 	virDomainPtr vdp;
 	char response = 1;
-	char *domain_desc;
+	char *domain_desc, *domain_desc_sanitized;
+	size_t sz;
 
 	if (!(vdp = get_domain(req, vp))) {
 		dprintf(2, "Could not find domain: %s\n", req->domain);
@@ -305,7 +267,14 @@
 		if (domain_desc) {
 			dprintf(3, "[[ XML Domain Info ]]\n");
 			dprintf(3, "%s\n[[ XML END ]]\n", domain_desc);
-			cleanup_xmldesc(domain_desc);
+
+			sz = 0;
+			if (cleanup_xml(domain_desc,
+					&domain_desc_sanitized, &sz) == 0) {
+				free(domain_desc);
+				domain_desc = domain_desc_sanitized;
+			}
+
 			dprintf(3, "[[ XML Domain Info (modified) ]]\n");
 			dprintf(3, "%s\n[[ XML END ]]\n", domain_desc);
 		} else {
@@ -431,7 +400,7 @@
 
 	if (!hp || !domain || !state || !strlen((char *)domain))
 		return -1;
-	if (!strcmp("Domain-0", (char *)domain))
+	if (!strcmp(DOMAIN0NAME, (char *)domain))
 		return -1;
 
 	return ckpt_read(hp, (char *)domain, state, sizeof(*state));
@@ -735,8 +704,10 @@
 	if (args.auth != AUTH_NONE || args.hash != HASH_NONE) {
 		key_len = read_key_file(args.key_file, key, sizeof(key));
 		if (key_len < 0) {
-			printf("Could not read key file\n");
-			return 1;
+			printf("Could not read %s; operating without "
+			       "authentication\n", args.key_file);
+			args.auth = AUTH_NONE;
+			args.hash = HASH_NONE;
 		}
 	}
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]