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

[Cluster-devel] cluster/rgmanager ChangeLog include/resgroup.h ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	mgrac sourceware org	2007-06-14 15:06:52

Modified files:
	rgmanager      : ChangeLog 
	rgmanager/include: resgroup.h 
	rgmanager/src/daemons: main.c rg_state.c rg_thread.c 
	rgmanager/src/utils: clusvcadm.c 

Log message:
	New flag -F for clusvcadm to respect failover domain (#211469). Also changes clusvcadm -e service00 which enable service on local node and do not respect failover (same as in RHEL4, in RHEL 5.0 it just wrote Failure).
	
	Old flag -F (freeze, introduced after RHEL50) was changed to -Z.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/resgroup.h.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_state.c.diff?cvsroot=cluster&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_thread.c.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clusvcadm.c.diff?cvsroot=cluster&r1=1.19&r2=1.20

--- cluster/rgmanager/ChangeLog	2007/06/13 20:13:26	1.45
+++ cluster/rgmanager/ChangeLog	2007/06/14 15:06:51	1.46
@@ -1,3 +1,10 @@
+2007-06-14 Marek Grac <mgrac at redhat.com>
+        * src/daemons/main.c, rg_state.c, rg_thread.c,
+          src/utils/clusvcadm.c
+        * #211469 - RFE: Flag (-F) for clusvcadm to respect failover domain
+        * 'clusvcadm -e service00' works same as in RHEL4 (differs from RHEL5.0)
+	* -F for freeze was changed to -Z 
+
 2007-06-13 Lon Hohberger <lhh at redhat.com>
 	* src/daemons/restree.c: Fix #229650 uninitialized bug
 
--- cluster/rgmanager/include/resgroup.h	2007/04/27 18:10:07	1.20
+++ cluster/rgmanager/include/resgroup.h	2007/06/14 15:06:51	1.21
@@ -90,6 +90,7 @@
 int handle_relocate_req(char *svcName, int request, int preferred_target,
 			int *new_owner);
 int handle_start_req(char *svcName, int req, int *new_owner);
+int handle_fd_start_req(char *svcName, int req, int *new_owner);
 int handle_recover_req(char *svcName, int *new_owner);
 int handle_start_remote_req(char *svcName, int req);
 
--- cluster/rgmanager/src/daemons/main.c	2007/04/19 20:21:22	1.38
+++ cluster/rgmanager/src/daemons/main.c	2007/06/14 15:06:51	1.39
@@ -493,7 +493,9 @@
 		/* Queue request */
 		rt_enqueue_request(msg_sm->sm_data.d_svcName,
 		  		   msg_sm->sm_data.d_action,
-		  		   ctx, 0, msg_sm->sm_data.d_svcOwner, 0, 0);
+		  		   ctx, 0, msg_sm->sm_data.d_svcOwner,
+		  		   msg_sm->sm_hdr.gh_arg1,
+		  		   msg_sm->sm_hdr.gh_arg2);
 		return 0;
 
 	case RG_EVENT:
--- cluster/rgmanager/src/daemons/rg_state.c	2007/04/27 18:10:10	1.32
+++ cluster/rgmanager/src/daemons/rg_state.c	2007/06/14 15:06:51	1.33
@@ -1316,7 +1316,7 @@
 	strncpy(msg_relo.sm_data.d_svcName, svcName,
 		sizeof(msg_relo.sm_data.d_svcName));
 	msg_relo.sm_data.d_ret = 0;
-
+	msg_relo.sm_data.d_svcOwner = target;
 	/* Open a connection to the other node */
 
 	if (msg_open(MSG_CLUSTER, target, RG_PORT, &ctx, 2)< 0) {
@@ -1592,7 +1592,7 @@
 handle_start_req(char *svcName, int req, int *new_owner)
 {
 	int ret, tolerance = FOD_BEST;
-	cluster_member_list_t *membership = member_list();
+//	cluster_member_list_t *membership = member_list();
 	int need_check = have_exclusive_resources();
 
 	/*
@@ -1601,7 +1601,7 @@
 	 */
 	if (req == RG_ENABLE)
 		tolerance = FOD_GOOD;
-	
+/*	
 	if (req != RG_RESTART &&
 	    req != RG_START_RECOVER &&
 	    (node_should_start_safe(my_id(), membership, svcName) <
@@ -1622,7 +1622,7 @@
 		}
 	}
 	free_member_list(membership);
-
+*/
 	/* Check for dependency.  We cannot start unless our
 	   dependency is met */
 	if (check_depend_safe(svcName) == 0)
@@ -1674,7 +1674,7 @@
 		return RG_EABORT;
 	}
 	
-relocate:
+//relocate:
 	/*
 	 * OK, it failed to start - but succeeded to stop.  Now,
 	 * we should relocate the service.
@@ -1743,10 +1743,12 @@
 	}
 	free_member_list(membership);
 
-	if (svc_start(svcName, req) == 0) {
+	x = svc_start(svcName, req);
+
+	if ((x == 0) || (x == RG_ERUN)) {
 		if (need_check)
 			pthread_mutex_unlock(&exclusive_mutex);
-		return 0;
+		return x;
 	}
 	if (need_check)
 		pthread_mutex_unlock(&exclusive_mutex);
@@ -1778,3 +1780,47 @@
 
 	return handle_start_req(svcName, RG_START_RECOVER, new_owner);
 }
+
+int
+handle_fd_start_req(char *svcName, int request, int *new_owner)
+{
+       cluster_member_list_t *allowed_nodes;
+       int target, me = my_id();
+       int ret;
+
+       allowed_nodes = member_list();
+
+       while (memb_count(allowed_nodes)) {
+               target = best_target_node(allowed_nodes, -1,
+                                         svcName, 1);
+               if (target == me) {
+                       ret = handle_start_remote_req(svcName, request);
+               } else if (target < 0) {
+                       free_member_list(allowed_nodes);
+                       return RG_EFAIL;
+               } else {
+                       ret = relocate_service(svcName, request, target);
+               }
+
+               switch(ret) {
+               case RG_ESUCCESS:
+                       return RG_ESUCCESS;
+               case RG_ERUN:
+                       return RG_ERUN;
+               case RG_EFAIL:
+                       memb_mark_down(allowed_nodes, target);
+                       continue;
+               case RG_EABORT:
+                       svc_report_failure(svcName);
+                       free_member_list(allowed_nodes);
+                       return RG_EFAIL;
+               default:
+                       clulog(LOG_ERR,
+                              "#6X: Invalid reply [%d] from member %d during"
+                              " relocate operation!\n", ret, target);
+               }
+       }
+
+       free_member_list(allowed_nodes);
+       return RG_EFAIL;
+}
--- cluster/rgmanager/src/daemons/rg_thread.c	2007/04/27 18:10:10	1.20
+++ cluster/rgmanager/src/daemons/rg_thread.c	2007/06/14 15:06:52	1.21
@@ -248,8 +248,15 @@
 				break;
 			}
 		case RG_START:
-			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/utils/clusvcadm.c	2007/04/27 18:10:10	1.19
+++ cluster/rgmanager/src/utils/clusvcadm.c	2007/06/14 15:06:52	1.20
@@ -39,11 +39,14 @@
 
 
 void
-build_message(SmMessageSt *msgp, int action, char *svcName, int target)
+build_message(SmMessageSt *msgp, int action, char *svcName, int target,
+		int arg1, int 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));
@@ -155,6 +158,8 @@
 printf("       %s -d <group>             Disable <group>\n", name);
 printf("       %s -e <group>             Enable <group>\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",
@@ -230,6 +235,7 @@
 	SmMessageSt msg;
 	generic_msg_hdr *h = (generic_msg_hdr *)&msg;
 	int action = RG_STATUS;
+	int fod = 0;
 	int node_specified = 0;
        	int me, svctarget = 0;
 	char *actionstr = NULL;
@@ -240,7 +246,7 @@
 		return 1;
 	}
 
-	while ((opt = getopt(argc, argv, "lSue:M:d:r:n:m:vR:s:F:U:qh?")) != EOF) {
+	while ((opt = getopt(argc, argv, "lSue:M:d:r:n:m:FvR:s:Z:U:qh?")) != EOF) {
 		switch (opt) {
 		case 'l':
 			return do_lock();
@@ -257,6 +263,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";
@@ -288,13 +302,18 @@
 			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;
 		case 'v':
 			printf("%s\n",PACKAGE_VERSION);
 			return 0;
-		case 'F':
+		case 'Z':
 			actionstr = "freezing";
 			action = RG_FREEZE;
 			svcname = optarg;
@@ -361,8 +380,8 @@
 				   */
 		//strcpy(nodename,"me");
 	}
-	
-	build_message(&msg, action, svcname, svctarget);
+
+	build_message(&msg, action, svcname, svctarget, fod, 0);
 
 	if (action != RG_RELOCATE && action != RG_MIGRATE) {
 		if (!node_specified)


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