Skip to contentSkip to conversation

cluster/rgmanager include/resgroup.h init.d/rg ...

Cluster-devel [email protected] 1 participant 1 message Jan 22, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: STABLE
Changes by: lhh at sourceware.org 2007-01-22 23:10:02

Modified files:
rgmanager/include: resgroup.h
rgmanager/init.d: rgmanager
rgmanager/src/clulib: clulog.c vft.c rgmanager/src/daemons: groups.c main.c nodeevent.c reslist.c
resrules.c rg_forward.c rg_state.c rg_thread.c
rgmanager/src/resources: Makefile clusterfs.sh fs.sh ip.sh
ocf-shellfuncs
rgmanager/src/utils: clustat.c clusvcadm.c
Added files:
rgmanager/src/resources: apache.metadata apache.sh
mysql.metadata mysql.sh openldap.metadata openldap.sh postgres-8.metadata postgres-8.sh samba.metadata samba.sh tomcat-5.metadata tomcat-5.sh

Log message:
Merge fixes from RHEL4 branch since rhel4U4

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/resgroup.h.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.3.2.5.6.2&r2=1.3.2.5.6.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/init.d/rgmanager.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.3.2.1.6.2&r2=1.3.2.1.6.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/clulog.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.2.2.1.6.3&r2=1.2.2.1.6.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/vft.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.7.2.3.6.3&r2=1.7.2.3.6.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.8.2.10.6.4&r2=1.8.2.10.6.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.9.2.8.6.8&r2=1.9.2.8.6.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/nodeevent.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.2.2.2&r2=1.2.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/reslist.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.6.2.4.6.2&r2=1.6.2.4.6.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.9.2.2.6.1&r2=1.9.2.2.6.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_forward.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.2.8.1&r2=1.2.8.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_state.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.4.2.8.6.5&r2=1.4.2.8.6.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_thread.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.7.2.3.6.4&r2=1.7.2.3.6.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/apache.metadata.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.3.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/apache.sh.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.9.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/mysql.metadata.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.3.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/mysql.sh.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.8.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/openldap.metadata.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.2.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/openldap.sh.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.7.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/postgres-8.metadata.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.2.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/postgres-8.sh.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.5.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/samba.metadata.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.2.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/samba.sh.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.5.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/tomcat-5.metadata.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.1.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/tomcat-5.sh.diff?cvsroot=cluster&only_with_tag=STABLE&r1=NONE&r2=1.1.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/Makefile.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.4.2.3.6.3&r2=1.4.2.3.6.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/clusterfs.sh.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.1.2.3.4.6&r2=1.1.2.3.4.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/fs.sh.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.4.2.6.4.7&r2=1.4.2.6.4.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/ip.sh.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.5.2.4.4.10&r2=1.5.2.4.4.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/ocf-shellfuncs.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.2.2.3&r2=1.2.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clustat.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.5.2.3.6.9&r2=1.5.2.3.6.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clusvcadm.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.2.2.3.6.4&r2=1.2.2.3.6.5

rgmanager/include/resgroup.h +10 -8
@@ -121,8 +121,8 @@
 int rt_enqueue_request(const char *resgroupname, int request, int response_fd,
        		       int max, uint64_t target, int arg0, int arg1);
 
-void send_response(int ret, request_t *req);
-void send_ret(int fd, char *name, int ret, int req);
+void send_response(int ret, uint64_t owner, request_t *req);
+void send_ret(int fd, char *name, int ret, int req, uint64_t newowner);
 
 /* do this op on all resource groups.  The handler for the request 
    will sort out whether or not it's a valid request given the state */
@@ -156,12 +156,14 @@
 cluster_member_list_t *member_list(void);
 uint64_t my_id(void);
 
-#define RG_EAGAIN	-6
-#define RG_EDEADLCK	-5
-#define RG_ENOSERVICE	-4
-#define RG_EFORWARD	-3
-#define RG_EABORT	-2
-#define RG_EFAIL	-1
+#define RG_ENODEDEATH	-8 /* Processing node died */
+#define RG_ERUN		-7 /* Service is running already */
+#define RG_EAGAIN	-6 /* Try again */
+#define RG_EDEADLCK	-5 /* Operation would cause deadlock */
+#define RG_ENOSERVICE	-4 /* Service does not exist */
+#define RG_EFORWARD	-3 /* Ask current service owner to do this, please */
+#define RG_EABORT	-2 /* Request cancelled */
+#define RG_EFAIL	-1 /* Generic error */
 #define RG_ESUCCESS	0
 
 
rgmanager/init.d/rgmanager +5 -1
@@ -96,10 +96,14 @@
 		[ -z "$RGMGR_OPTS" ] && RGMGR_OPTS="-t 30"
 		echo -n $"Starting $ID: "
 		daemon $RGMGRD $RGMGR_OPTS
+		rv=$?
 		echo
 
 		# To be consistent...
-		touch /var/lock/subsys/rgmanager
+		if [ $rv -eq 0 ]; then
+			touch /var/lock/subsys/rgmanager
+		fi
+		exit $rv
 		;;
 
 	restart)
rgmanager/src/clulib/clulog.c +2 -2
@@ -20,7 +20,7 @@
 /** @file
  * Library routines for communicating with the logging daemon.
  *
- *  $Id: clulog.c,v 1.2.2.1.6.3 2006/11/03 16:29:58 lhh Exp $
+ *  $Id: clulog.c,v 1.2.2.1.6.4 2007/01/22 23:10:01 lhh Exp $
  *
  *  Author: Jeff Moyer <[email protected]>
  */
@@ -50,7 +50,7 @@
 #include <string.h>
 
 
-static const char *version __attribute__ ((unused)) = "$Revision: 1.2.2.1.6.3 $";
+static const char *version __attribute__ ((unused)) = "$Revision: 1.2.2.1.6.4 $";
 
 #ifdef DEBUG
 #include <assert.h>
rgmanager/src/clulib/vft.c +2 -4
@@ -44,8 +44,6 @@
 #include <signals.h>
 
 
-int clu_lock_verbose(char *lockname, int flags, void **lockpp);
-
 static int vf_lfds[2];
 static int vf_lfd = 0;
 static key_node_t *key_list = NULL;	/** List of key nodes. */
@@ -1187,7 +1185,7 @@
 	pthread_mutex_lock(&vf_mutex);
 	/* Obtain cluster lock on it. */
 	snprintf(lock_name, sizeof(lock_name), "usrm::vf");
-	l = clu_lock_verbose(lock_name, CLK_EX, &lockp);
+	l = clu_lock(lock_name, CLK_EX, &lockp);
 	if (l < 0) {
 		clu_unlock(lock_name, lockp);
 		pthread_mutex_unlock(&vf_mutex);
@@ -1524,7 +1522,7 @@
 	/* Obtain cluster lock on it. */
 	pthread_mutex_lock(&vf_mutex);
 	snprintf(lock_name, sizeof(lock_name), "usrm::vf");
-	l = clu_lock_verbose(lock_name, CLK_EX, &lockp);
+	l = clu_lock(lock_name, CLK_EX, &lockp);
 	if (l < 0) {
 		clu_unlock(lock_name, lockp);
 		pthread_mutex_unlock(&vf_mutex);
rgmanager/src/daemons/groups.c +13 -2
@@ -879,8 +879,19 @@
 		if (curr->rn_resource->r_flags & RF_NEEDSTART)
 			need_init = 1;
 
-		if (get_rg_state_local(name, &svcblk) < 0) {
-			continue;
+		if (!need_init) {
+			if (get_rg_state_local(name, &svcblk) < 0)
+				continue;
+		} else {
+			if (rg_lock(name, &lockp) != 0)
+				continue;
+
+			if (get_rg_state(name, &svcblk) < 0) {
+				rg_unlock(name, lockp);
+				continue;
+			}
+
+			rg_unlock(name, lockp);
 		}
 
 		if (!need_init && svcblk.rs_owner != my_id()) {
rgmanager/src/daemons/main.c +4 -1
@@ -426,12 +426,15 @@
 		    	    sizeof (SmMessageSt))
 				clulog(LOG_ERR, "#40: Error replying to "
 				       "action request.\n");
+			break;
 		}
 
 		/* 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:
rgmanager/src/daemons/nodeevent.c +0 -1
@@ -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 *
rgmanager/src/daemons/reslist.c +79 -2

104 lines not on this page · raw message

rgmanager/src/daemons/resrules.c +58 -10

121 lines not on this page · raw message

rgmanager/src/daemons/rg_forward.c +35 -10

62 lines not on this page · raw message

rgmanager/src/daemons/rg_state.c +81 -129

303 lines not on this page · raw message

rgmanager/src/daemons/rg_thread.c +12 -6
@@ -145,7 +145,7 @@
 		list_remove(list, curr);
 		dprintf("Removed request %d\n", curr->rr_request);
 		if (curr->rr_resp_fd != -1) {
-			send_response(RG_EABORT, curr);
+			send_response(RG_EABORT, NODE_ID_NONE, curr);
 		}
 		rq_free(curr);
 	}
@@ -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:
@@ -412,9 +419,8 @@
 
 		if (ret != RG_NONE && rg_initialized() &&
 		    (req->rr_resp_fd >= 0)) {
-			send_response(error, req);
+			send_response(error, newowner, req);
 		}
-
 		
 		rq_free(req);
 	}
@@ -611,7 +617,7 @@
 		case RG_START:
 		case RG_ENABLE:
 			send_ret(response_fd, resgroup->rt_name, RG_EDEADLCK,
-				 request);
+				 request, NODE_ID_NONE);
 			break;
 		}
 		fprintf(stderr, "Failed to queue request: Would block\n");

/cvs/cluster/cluster/rgmanager/src/resources/apache.metadata,v --> standard output revision 1.3.8.1

- renamed from rgmanager/src/resources/apache.metadata +95 -0

95 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/apache.sh,v --> standard output revision 1.9.8.1

- renamed from rgmanager/src/resources/apache.sh +277 -0

277 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/mysql.metadata,v --> standard output revision 1.3.8.1

- renamed from rgmanager/src/resources/mysql.metadata +96 -0

96 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/mysql.sh,v --> standard output revision 1.8.8.1

- renamed from rgmanager/src/resources/mysql.sh +205 -0

205 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/openldap.metadata,v --> standard output revision 1.2.8.1

- renamed from rgmanager/src/resources/openldap.metadata +98 -0

98 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/openldap.sh,v --> standard output revision 1.7.8.1

- renamed from rgmanager/src/resources/openldap.sh +240 -0

240 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/postgres-8.metadata,v --> standard output revision 1.2.8.1

- renamed from rgmanager/src/resources/postgres-8.metadata +95 -0

95 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/postgres-8.sh,v --> standard output revision 1.5.8.1

- renamed from rgmanager/src/resources/postgres-8.sh +225 -0

225 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/samba.metadata,v --> standard output revision 1.2.8.1

- renamed from rgmanager/src/resources/samba.metadata +89 -0

89 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/samba.sh,v --> standard output revision 1.5.8.1

- renamed from rgmanager/src/resources/samba.sh +254 -0

254 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/tomcat-5.metadata,v --> standard output revision 1.1.8.1

- renamed from rgmanager/src/resources/tomcat-5.metadata +104 -0

104 lines not on this page · raw message

/cvs/cluster/cluster/rgmanager/src/resources/tomcat-5.sh,v --> standard output revision 1.1.8.1

- renamed from rgmanager/src/resources/tomcat-5.sh +287 -0

287 lines not on this page · raw message

rgmanager/src/resources/Makefile +12 -3
@@ -18,9 +18,16 @@
 INCLUDE += -I $(top_srcdir)/include
 
 RESOURCES=fs.sh service.sh ip.sh nfsclient.sh nfsexport.sh \
-	script.sh netfs.sh clusterfs.sh smb.sh
-
-TARGETS=${RESOURCES} ocf-shellfuncs svclib_nfslock
+	script.sh netfs.sh clusterfs.sh smb.sh \
+	apache.sh openldap.sh samba.sh mysql.sh \
+	postgres-8.sh tomcat-5.sh
+
+METADATA=apache.metadata openldap.metadata samba.metadata \
+	mysql.metadata postgres-8.metadata tomcat-5.metadata
+
+TARGETS=${RESOURCES} ocf-shellfuncs svclib_nfslock \
+	utils/config-utils.sh utils/ra-skelet.sh utils/messages.sh \
+	utils/httpd-parse-config.pl utils/tomcat-parse-config.pl
 
 all:
 
@@ -28,7 +35,9 @@
 	echo ${sharedir}
 	echo ${sbindir}
 	install -d ${sharedir}
+	install -d ${sharedir}/utils
 	install $(TARGETS) ${sharedir}
+	install -m 644 $(METADATA) ${sharedir}
 
 uninstall:
 	${UNINSTALL} ${TARGETS} ${sharedir}
rgmanager/src/resources/clusterfs.sh +1 -1
@@ -898,7 +898,7 @@
  	isAlive ${OCF_RESKEY_mountpoint}
  	[ $? -eq $YES ] && exit 0
 
-	ocf_log err "fs:${OCF_RESKEY_name}: Mount point is not accessible!"
+	ocf_log err "clusterfs:${OCF_RESKEY_name}: Mount point is not accessible!"
 	exit $OCF_ERR_GENERIC
 	;;
 restart)
rgmanager/src/resources/fs.sh +14 -0
@@ -496,6 +496,18 @@
 
 
 #
+# trim_trailing_slash path
+#
+# Trim trailing slash from given path.
+#
+trim_trailing_slash() {
+	declare mpath=$1
+
+	echo $mpath | sed -e 's/\/*$//'
+}
+
+
+#
 # isMounted device mount_point
 #
 # Check to see if the device is mounted.  Print a warning if its not
@@ -523,6 +535,8 @@
 	do
 		#echo "spec=$1 dev=$dev  tmp_dev=$tmp_dev"
 		tmp_dev=$(real_device $tmp_dev)
+		tmp_mp=$(trim_trailing_slash $tmp_mp)
+		mp=$(trim_trailing_slash $mp)
 
 		if [ -n "$tmp_dev" -a "$tmp_dev" = "$dev" ]; then
 			#
rgmanager/src/resources/ip.sh +3 -0
@@ -884,6 +884,9 @@
 		exit 0
 	fi
 	ip_op ${OCF_RESKEY_family} add ${OCF_RESKEY_address}
+	if [ $? -ne 0 ]; then
+		exit $OCF_ERR_GENERIC
+	fi
 
 	if [ $NFS_TRICKS -eq 0 ]; then
 		if [ "$OCF_RESKEY_nfslock" = "yes" ] || \
rgmanager/src/resources/ocf-shellfuncs +1 -1
@@ -1,5 +1,5 @@
 #
-# 	$Id: ocf-shellfuncs,v 1.2.2.3 2006/11/03 16:29:58 lhh Exp $
+# 	$Id: ocf-shellfuncs,v 1.2.2.4 2007/01/22 23:10:01 lhh Exp $
 #
 # 	Common helper functions for the OCF Resource Agents supplied by
 # 	heartbeat.
rgmanager/src/utils/clustat.c +67 -42

96 lines not on this page · raw message

rgmanager/src/utils/clusvcadm.c +113 -13

126 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.