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

[Cluster-devel] cluster/rgmanager init.d/rgmanager src/daemons ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	lhh sourceware org	2007-01-04 15:52:41

Modified files:
	rgmanager/init.d: rgmanager 
	rgmanager/src/daemons: rg_thread.c rg_state.c main.c nodeevent.c 
	rgmanager/src/utils: clusvcadm.c 

Log message:
	Fix #210482: Allow enable using failover domain priorities

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/init.d/rgmanager.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.4&r2=1.3.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_thread.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.8&r2=1.7.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_state.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.4.2.17&r2=1.4.2.18
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.9.2.21&r2=1.9.2.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/nodeevent.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.2&r2=1.1.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clusvcadm.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.8&r2=1.2.2.9

--- cluster/rgmanager/init.d/rgmanager	2006/12/13 18:19:56	1.3.2.4
+++ cluster/rgmanager/init.d/rgmanager	2007/01/04 15:52:41	1.3.2.5
@@ -100,7 +100,7 @@
 		echo
 
 		# To be consistent...
-		if [ $ret -eq 0 ]; then
+		if [ $rv -eq 0 ]; then
 			touch /var/lock/subsys/rgmanager
 		fi
 		exit $rv
--- cluster/rgmanager/src/daemons/rg_thread.c	2006/12/13 18:19:56	1.7.2.8
+++ cluster/rgmanager/src/daemons/rg_thread.c	2007/01/04 15:52:41	1.7.2.9
@@ -237,8 +237,15 @@
 
 		case RG_START:
 		case RG_ENABLE:
-			error = handle_start_req(myname, req->rr_request,
-						 &newowner);
+			if (req->rr_arg0) {
+				error = handle_fd_start_req(myname,
+						            req->rr_request,
+						            &newowner);
+			} else {
+				error = handle_start_req(myname,
+							 req->rr_request,
+							 &newowner);
+			}
 			break;
 
 		case RG_RELOCATE:
--- cluster/rgmanager/src/daemons/rg_state.c	2006/12/13 18:19:56	1.4.2.17
+++ cluster/rgmanager/src/daemons/rg_state.c	2007/01/04 15:52:41	1.4.2.18
@@ -1258,6 +1258,60 @@
 }
 
 
+int
+handle_fd_start_req(char *svcName, int request, uint64_t *new_owner)
+{
+	cluster_member_list_t *allowed_nodes, *backup = NULL;
+	uint64_t target, me = my_id();
+	int ret, x;
+	
+	allowed_nodes = member_list();
+
+	while (memb_count(allowed_nodes)) {
+		target = best_target_node(allowed_nodes, NODE_ID_NONE,
+					  svcName, 1);
+		if (target == me) {
+			ret = handle_start_remote_req(svcName, request);
+		} else {
+			ret = relocate_service(svcName, request, target);
+		}
+
+		switch (ret) {
+		case RG_ERUN:
+			return RG_ERUN;
+		case RG_EFAIL:
+			memb_mark_down(allowed_nodes, target);
+			continue;
+		case RG_EABORT:
+			svc_report_failure(svcName);
+			cml_free(allowed_nodes);
+			return FAIL;
+		case NO:
+			/* state uncertain */
+			cml_free(allowed_nodes);
+			clulog(LOG_DEBUG, "State Uncertain: svc:%s "
+			       "nid:%08x%08x req:%d\n", svcName,
+			       (uint32_t)(target>>32)&0xffffffff,
+			       (uint32_t)(target&0xffffffff), request);
+			return 0;
+		case 0:
+			*new_owner = target;
+			clulog(LOG_NOTICE, "Service %s is now running "
+			       "on member %d\n", svcName, (int)target);
+			cml_free(allowed_nodes);
+			return 0;
+		default:
+			clulog(LOG_ERR,
+			       "#61: Invalid reply from member %d during"
+			       " relocate operation!\n", target);
+		}
+	}
+	
+	cml_free(allowed_nodes);
+	return RG_EFAIL;
+}
+
+
 /**
  * handle_start_req - Handle a generic start request from a user or during
  * service manager boot.
@@ -1393,11 +1447,14 @@
 	}
 	cml_free(membership);
 
-	if (svc_start(svcName, req) == 0)
+	x = svc_start(svcName, req);
+	if (x == 0)
 		return 0;
+	if (x == RG_ERUN)
+		return RG_ERUN;
 
 	if (svc_stop(svcName, RG_STOP_RECOVER) == 0)
-		return FAIL;
+		return RG_EFAIL;
 
 	svc_fail(svcName);
 	return RG_EABORT;
--- cluster/rgmanager/src/daemons/main.c	2006/12/13 18:19:56	1.9.2.21
+++ cluster/rgmanager/src/daemons/main.c	2007/01/04 15:52:41	1.9.2.22
@@ -432,7 +432,9 @@
 		/* Queue request */
 		rt_enqueue_request(msg_sm.sm_data.d_svcName,
 		  		   msg_sm.sm_data.d_action,
-		  		   fd, 0, msg_sm.sm_data.d_svcOwner, 0, 0);
+		  		   fd, 0, msg_sm.sm_data.d_svcOwner, 
+		  		   msg_sm.sm_hdr.gh_arg1,
+		  		   msg_sm.sm_hdr.gh_arg2);
 		break;
 
 	case RG_EXITING:
--- cluster/rgmanager/src/daemons/nodeevent.c	2006/06/21 18:34:19	1.1.2.2
+++ cluster/rgmanager/src/daemons/nodeevent.c	2007/01/04 15:52:41	1.1.2.3
@@ -36,7 +36,6 @@
 static nevent_t *event_queue = NULL;
 static pthread_mutex_t ne_queue_mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_t ne_thread = 0;
-int ne_queue_request(int local, uint64_t nodeid, int state);
 
 
 void *
--- cluster/rgmanager/src/utils/clusvcadm.c	2007/01/03 21:08:17	1.2.2.8
+++ cluster/rgmanager/src/utils/clusvcadm.c	2007/01/04 15:52:41	1.2.2.9
@@ -37,11 +37,14 @@
 
 
 void
-build_message(SmMessageSt *msgp, int action, char *svcName, uint64_t target)
+build_message(SmMessageSt *msgp, int action, char *svcName, uint64_t target,
+	      uint32_t arg1, uint32_t arg2)
 {
 	msgp->sm_hdr.gh_magic = GENERIC_HDR_MAGIC;
 	msgp->sm_hdr.gh_command = RG_ACTION_REQUEST;
 	msgp->sm_hdr.gh_length = sizeof(*msgp);
+	msgp->sm_hdr.gh_arg1 = arg1;
+	msgp->sm_hdr.gh_arg2 = arg2;
 	msgp->sm_data.d_action = action;
 	strncpy(msgp->sm_data.d_svcName, svcName,
 		sizeof(msgp->sm_data.d_svcName));
@@ -192,6 +195,8 @@
 printf("       %s -d <group>             Disable <group>\n", name);
 printf("       %s -e <group>             Enable <group> on the local node\n",
        name);
+printf("       %s -e <group> -F          Enable <group> according to failover\n"
+       "                                 domain rules\n", name);
 printf("       %s -e <group> -m <member> Enable <group>"
        " on <member>\n", name);
 printf("       %s -r <group> -m <member> Relocate <group> [to <member>]\n",
@@ -219,7 +224,7 @@
 	extern char *optarg;
 	char *svcname=NULL, nodename[256];
 	int opt;
-	int msgfd = -1, fd;
+	int msgfd = -1, fd, fod = 0;
 	SmMessageSt msg;
 	int action = RG_STATUS;
 	int node_specified = 0;
@@ -232,7 +237,7 @@
 		return 1;
 	}
 
-	while ((opt = getopt(argc, argv, "lSue:d:r:n:m:vR:s:qh?")) != EOF) {
+	while ((opt = getopt(argc, argv, "lSue:d:r:Fn:m:vR:s:qh?")) != EOF) {
 		switch (opt) {
 		case 'l':
 			return do_lock();
@@ -249,6 +254,14 @@
 			action = RG_ENABLE;
 			svcname = optarg;
 			break;
+		case 'F':
+			if (node_specified) {
+				fprintf(stderr,
+					"Cannot use '-F' with '-n' or '-m'\n");
+				return 1;
+			}
+			fod = 1;
+			break;
 		case 'd':
 			/* DISABLE */
 			actionstr = "disabling";
@@ -274,7 +287,11 @@
 			break;
 		case 'm': /* member ... */
 		case 'n': /* node .. same thing */
-
+			if (fod) {
+				fprintf(stderr,
+					"Cannot use '-F' with '-n' or '-m'\n");
+				return 1;
+			}
 			strncpy(nodename,optarg,sizeof(nodename));
 			node_specified = 1;
 			break;
@@ -322,7 +339,7 @@
 				   sizeof(nodename));
 	}
 	
-	build_message(&msg, action, svcname, svctarget);
+	build_message(&msg, action, svcname, svctarget, fod, 0);
 
 	if (action != RG_RELOCATE) {
 		printf("Member %s %s %s", nodename, actionstr, svcname);


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