All of lore.kernel.org
 help / color / mirror / Atom feed
From: lhh@sourceware.org <lhh@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/fence/agents/xvm Makefile fence_xvmd.c ...
Date: 26 Jun 2007 17:17:41 -0000	[thread overview]
Message-ID: <20070626171741.27278.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	lhh at 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;
 		}
 	}
 



             reply	other threads:[~2007-06-26 17:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-26 17:17 lhh [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-06-26 17:23 [Cluster-devel] cluster/fence/agents/xvm Makefile fence_xvmd.c lhh
2006-10-05 22:57 cfeist

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070626171741.27278.qmail@sourceware.org \
    --to=lhh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.