Skip to contentSkip to conversation

cluster/rgmanager ChangeLog include/resgroup.h ...

Cluster-devel [email protected] 1 participant 1 message Jun 26, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: lhh at sourceware.org 2007-06-26 21:55:46

Modified files:
rgmanager : ChangeLog
rgmanager/include: resgroup.h reslist.h rgmanager/src/clulib: rg_strings.c rgmanager/src/daemons: groups.c main.c nodeevent.c resrules.c
restree.c rg_state.c rg_thread.c test.c
rgmanager/src/resources: vm.sh

Log message:
Fix: #244143, #232300, and patch up a couple of other fixed bugs (see ChangeLog)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.31.2.14&r2=1.31.2.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/resgroup.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15.2.4&r2=1.15.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/reslist.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15.2.3&r2=1.15.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/rg_strings.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.2&r2=1.5.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.25.2.6&r2=1.25.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.34.2.5&r2=1.34.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/nodeevent.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.2&r2=1.4.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.16.2.5&r2=1.16.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/restree.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.23.2.7&r2=1.23.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_state.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.24.2.8&r2=1.24.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_thread.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15.2.5&r2=1.15.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/test.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.2&r2=1.6.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/vm.sh.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.3&r2=1.1.2.4

rgmanager/ChangeLog +24 -0
@@ -1,3 +1,27 @@
+2007-06-26 Lon Hohberger <[email protected]>
+	* src/daemons/vm.sh: Un-break migrate (#231692).  Make status
+	checks happen every 30 seconds instead of 30 minutes.
+	* include/resgroup.h: Move inline recovery flags to a header file,
+	add RG_STATUS_INQUIRY for locating virtual machines which may have
+	migrated.
+	* include/reslist.h: Change res_exec() back to using agent_op_str()
+	inline so we can squelch errors while performing RG_STATUS_INQUIRY
+	* src/clulib/rg_strings.c: Add new strings for new error code / 
+	request types
+	* src/daemons/groups.c: Change group_migrate() to use the correct
+	calling semantics
+	* src/daemons/main.c, nodeevent.c: Clean up cases which could cause
+	#244143
+	* src/daemons/resrules.c: Clear up noise
+	* src/daemons/restree.c: Squelch errors during RG_STATUS_INQUIRY
+	Patch up inline service recovery (#229650)
+	* src/daemons/rg_state.c: Don't let migrations or relocations to a
+	node running exclusive services occur in the first place and return
+	a useful error. (goes with #237144).  Locate virtual machines (or
+	generally, services with the 'migrate' ability) elsewhere in the
+	cluster prior to trying to start one.  Detect if someone migrates
+	such a service without using the cluster tools (#232300)
+
 2007-06-18 Lon Hohberger <[email protected]>
 	* src/daemons/restree.c: Wait for status check time intervals to 
 	elapse for the first status check in rgmanager, but not in rg_test.
rgmanager/include/resgroup.h +9 -0
@@ -79,6 +79,7 @@
 #define RG_UNLOCK	  20
 #define RG_QUERY_LOCK	  21
 #define RG_MIGRATE	  22
+#define RG_STATUS_INQUIRY 23
 #define RG_NONE		  999
 
 const char *rg_req_str(int req);
@@ -163,6 +164,8 @@
 int my_id(void);
 
 /* Return codes */
+#define RG_EFENCE	-12		/* Fencing operation pending */
+#define RG_ENODE	-11		/* Node is dead/nonexistent */
 #define RG_ERUN		-10		/* Service is already running */
 #define RG_EQUORUM	-9		/* Operation requires quorum */
 #define RG_EINVAL	-8		/* Invalid operation for resource */
@@ -195,6 +198,12 @@
 #define FOD_RESTRICTED		(1<<1)
 #define FOD_NOFAILBACK		(1<<2)
 
+/*
+   Status tree flags
+ */
+#define SFL_FAILURE		(1<<0)
+#define SFL_RECOVERABLE		(1<<1)
+
 //#define DEBUG
 #ifdef DEBUG
 
rgmanager/include/reslist.h +1 -1
@@ -144,7 +144,7 @@
 int res_status(resource_node_t **tree, resource_t *res, void *ret);
 int res_condstart(resource_node_t **tree, resource_t *res, void *ret);
 int res_condstop(resource_node_t **tree, resource_t *res, void *ret);
-int res_exec(resource_node_t *node, const char *op, const char *arg, int depth);
+int res_exec(resource_node_t *node, int op, const char *arg, int depth);
 /*int res_resinfo(resource_node_t **tree, resource_t *res, void *ret);*/
 int expand_time(char *val);
 int store_action(resource_act_t **actsp, char *name, int depth, int timeout, int interval);
rgmanager/src/clulib/rg_strings.c +4 -0
@@ -26,6 +26,8 @@
 
 
 const struct string_val rg_error_strings[] = {
+	{ RG_EFENCE,    "Fencing operation pending; try again later" },
+	{ RG_ENODE,     "Target node dead / nonexistent" },
 	{ RG_ERUN,      "Service is already running" },
 	{ RG_EQUORUM,	"Operation requires quorum" },
 	{ RG_EINVAL,	"Invalid operation for resource" },
@@ -67,6 +69,7 @@
 	{RG_UNLOCK, "unlocking"},
 	{RG_QUERY_LOCK, "lock status inquiry"},
 	{RG_MIGRATE, "migrate"},
+	{RG_STATUS_INQUIRY, "out of band service status inquiry"},
 	{RG_NONE, "none"},
 	{0, NULL}
 };
@@ -145,5 +148,6 @@
 const char *
 agent_op_str(int val)
 {
+		printf("searching agent_ops for %d\n", val);
 	return rg_search_table(agent_ops, val);
 }
rgmanager/src/daemons/groups.c +1 -1
@@ -893,7 +893,7 @@
 	}
 	
 	clulog(LOG_NOTICE, "Migrating %s to %s\n", groupname, tgt_name);
-	ret = res_exec(rn, agent_op_str(RS_MIGRATE), tgt_name, 0);
+	ret = res_exec(rn, RS_MIGRATE, tgt_name, 0);
 	if (ret == 0) {
 		clulog(LOG_NOTICE,
 		       "Migration of %s to %s completed\n",
rgmanager/src/daemons/main.c +8 -2
@@ -617,10 +617,12 @@
 		clulog(LOG_WARNING, "#67: Shutting down uncleanly\n");
 		rg_set_inquorate();
 		rg_doall(RG_INIT, 1, "Emergency stop of %s");
+		rg_set_uninitialized();
 #if defined(LIBCMAN_VERSION) && LIBCMAN_VERSION >= 2
 		/* cman_replyto_shutdown() */
 #endif
-		exit(0);
+		running = 0;
+		break;
 	}
 
 	return ret;
@@ -700,6 +702,9 @@
 		}
 	}
 
+	if (!running)
+		return 0;
+
 	if (need_reconfigure || check_config_update()) {
 		need_reconfigure = 0;
 		configure_logging(-1, 0);
@@ -985,7 +990,8 @@
 		}
 	}
 
-	cleanup(cluster_ctx);
+	if (rg_initialized())
+		cleanup(cluster_ctx);
 	clulog(LOG_NOTICE, "Shutdown complete, exiting\n");
 	clu_lock_finished(rgmanager_lsname);
 	cman_finish(clu);
rgmanager/src/daemons/nodeevent.c +3 -1
@@ -72,8 +72,10 @@
 	if (local) {
 
 		/* Local Node Event */
-		if (nodeStatus == 0)
+		if (nodeStatus == 0) {
+			clulog(LOG_ERR, "Exiting uncleanly\n");
 			hard_exit();
+		}
 
 		if (!rg_initialized()) {
 			if (init_resource_groups(0) != 0) {
rgmanager/src/daemons/resrules.c +1 -1
@@ -1058,7 +1058,7 @@
 			continue;
 
  		if (st_buf.st_mode & (S_IXUSR|S_IXOTH|S_IXGRP)) {
- 			printf("Loading resource rule from %s\n", path);
+ 			//printf("Loading resource rule from %s\n", path);
   			load_resource_rulefile(path, rules);
  		}
 	}
rgmanager/src/daemons/restree.c +31 -63

227 lines not on this page · raw message

rgmanager/src/daemons/rg_state.c +260 -22

419 lines not on this page · raw message

rgmanager/src/daemons/rg_thread.c +13 -0
@@ -429,6 +429,19 @@
 
 			break;
 
+		case RG_STATUS_INQUIRY:
+			error = svc_status_inquiry(myname);
+
+			if (error == 0) {
+				ret = RG_SUCCESS;
+				newowner = my_id();
+			} else {
+				ret = RG_EFAIL;
+				newowner = -1;
+			}
+
+			break;
+
 		default:
 			printf("Unhandled request %d\n", req->rr_request);
 			ret = RG_NONE;
rgmanager/src/daemons/test.c +3 -3
@@ -192,9 +192,9 @@
 	} else if (!strcmp(argv[1], "status")) {
 		printf("Checking status of %s...\n", argv[3]);
 
-		if (res_status(&tree, curres, NULL)) {
+		ret = res_status(&tree, curres, NULL);
+		if (ret) {
 			printf("Status check of %s failed\n", argv[3]);
-			ret = -1;
 			goto out;
 		}
 		printf("Status of %s is good\n", argv[3]);
@@ -354,5 +354,5 @@
 out:
 	xmlCleanupParser();
 	malloc_dump_table();
-	return 0;
+	return ret;
 }
rgmanager/src/resources/vm.sh +8 -3
@@ -180,9 +180,8 @@
         <action name="start" timeout="20"/>
         <action name="stop" timeout="120"/>
 	
-	<!-- No-ops.  Groups are abstract resource types.  -->
-        <action name="status" timeout="10" interval="30m"/>
-        <action name="monitor" timeout="10" interval="30m"/>
+        <action name="status" timeout="10" interval="30"/>
+        <action name="monitor" timeout="10" interval="30"/>
 
 	<!-- reconfigure - reconfigure with new OCF parameters.
 	     NOT OCF COMPATIBLE AT ALL -->
@@ -278,6 +277,8 @@
 	#
 	declare cmdline
 
+	status && return 0
+
 	cmdline="`build_xm_cmdline`"
 
 	echo "# xm command line: $cmdline"
@@ -347,6 +348,10 @@
 status()
 {
 	xm list $OCF_RESKEY_name &> /dev/null
+	if [ $? -eq 0 ]; then
+		return 0
+	fi
+	xm list migrating-$OCF_RESKEY_name &> /dev/null
 	return $?
 }