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

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



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	lhh sourceware org	2007-11-19 17:03:27

Modified files:
	fence/agents/xvm: fence_xvmd.c xml.c 

Log message:
	Ancillary NOCLUSTER mode fixes for fence_xvmd

Patches:
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.8&r2=1.4.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/xml.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.3&r2=1.1.2.4

--- cluster/fence/agents/xvm/fence_xvmd.c	2007/11/14 18:41:27	1.4.2.8
+++ cluster/fence/agents/xvm/fence_xvmd.c	2007/11/19 17:03:27	1.4.2.9
@@ -219,7 +219,8 @@
 
 int
 do_fence_request_tcp(fence_req_t *req, fence_auth_type_t auth,
-		     void *key, size_t key_len, virConnectPtr vp)
+		     void *key, size_t key_len, virConnectPtr vp,
+		     int flags)
 {
 	int fd = -1, ret = -1;
 	virDomainPtr vdp;
@@ -227,7 +228,7 @@
 	char *domain_desc, *domain_desc_sanitized;
 	size_t sz;
 
-	if (!(vdp = get_domain(req, vp))) {
+	if (!(vdp = get_domain(req, vp)) && (!(flags & F_NOCLUSTER))) {
 		dbg_printf(2, "Could not find domain: %s\n", req->domain);
 		goto out;
 	}
@@ -246,6 +247,12 @@
 		break;
 	case FENCE_OFF:
 		printf("Destroying domain %s...\n", (char *)req->domain);
+		if (!vdp && (flags & F_NOCLUSTER)) {
+			dbg_printf(2, "[OFF + NOCLUSTER] Nothing to do - "
+				   "domain does not exist\n");
+			response = 0;
+			break;
+		}
 
 		dbg_printf(2, "[OFF] Calling virDomainDestroy\n");
 		ret = virDomainDestroy(vdp);
@@ -263,6 +270,14 @@
 	case FENCE_REBOOT:
 		printf("Rebooting domain %s...\n",
 		       (char *)req->domain);
+
+		if (!vdp && (flags & F_NOCLUSTER)) {
+			dbg_printf(2, "[REBOOT + NOCLUSTER] Nothing to do - "
+				   "domain does not exist\n");
+			response = 0;
+			break;
+		}
+
 		domain_desc = virDomainGetXMLDesc(vdp, 0);
 
 		if (domain_desc) {
@@ -283,10 +298,10 @@
 			       "libvirt\n");
 		}
 
-		dbg_printf(2, "[REBOOT] Calling virDomainDestroy\n");
+		dbg_printf(2, "[REBOOT] Calling virDomainDestroy(%p)\n", vdp);
 		ret = virDomainDestroy(vdp);
 		if (ret < 0) {
-			printf("virDomainDestroy() failed: %d\n", ret);
+			printf("virDomainDestroy() failed: %d/%d\n", ret, errno);
 			if (domain_desc)
 				free(domain_desc);
 			break;
@@ -652,7 +667,7 @@
 		case AUTH_SHA512:
 			printf("Plain TCP request\n");
 			do_fence_request_tcp(&data, args->auth, key,
-					     key_len, vp);
+					     key_len, vp, args->flags);
 			break;
 		default:
 			printf("XXX Unhandled authentication\n");
--- cluster/fence/agents/xvm/xml.c	2007/10/10 16:14:15	1.1.2.3
+++ cluster/fence/agents/xvm/xml.c	2007/11/19 17:03:27	1.1.2.4
@@ -82,6 +82,8 @@
 	flip_graphics_port(doc);
 
 	os_node = get_os_node(doc);
+	if (!os_node)
+		return -1;
 
 	curr = os_node->children;
 	while (curr) {


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