cluster/rgmanager src/daemons/rg_forward.c src ...
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: lhh at sourceware.org 2006-12-13 18:19:57
Modified files:
rgmanager/src/daemons: rg_forward.c resrules.c rg_thread.c
reslist.c rg_state.c main.c
rgmanager/init.d: rgmanager rgmanager/src/clulib: vft.c rgmanager/src/utils: clusvcadm.c clustat.c rgmanager/src/resources: ip.sh rgmanager/include: resgroup.h
Log message:
Fix #193603 (part 2; return error code if rgmanager start fails), #210455, #212110, #216774, #212634/#218112. Fix bug in ip.sh allowing start of the IP if the link was down, preventing failover (linux-cluster reported).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_forward.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.1&r2=1.2.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.9.2.4&r2=1.9.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.7&r2=1.7.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/reslist.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.6.2.6&r2=1.6.2.7
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.16&r2=1.4.2.17
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.9.2.20&r2=1.9.2.21
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/init.d/rgmanager.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.3&r2=1.3.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/vft.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.6&r2=1.7.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clusvcadm.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.6&r2=1.2.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clustat.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.14&r2=1.5.2.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/ip.sh.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.15&r2=1.5.2.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/resgroup.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.7&r2=1.3.2.8
rgmanager/src/daemons/rg_forward.c +1 -1
@@ -97,7 +97,7 @@msg_close (fd);swab_SmMessageSt (&msg); -send_response (msg.sm_data.d_ret, req); +send_response (msg.sm_data.d_ret, req->rr_target, req);rq_free (req);
rgmanager/src/daemons/resrules.c +58 -10
121 lines not on this page · raw message
rgmanager/src/daemons/rg_thread.c +3 -4
@@ -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); }
@@ -412,9 +412,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 +610,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" );
rgmanager/src/daemons/reslist.c +79 -2
104 lines not on this page · raw message
rgmanager/src/daemons/rg_state.c +22 -127
227 lines not on this page · raw message
rgmanager/src/daemons/main.c +1 -0
@@ -426,6 +426,7 @@ sizeof (SmMessageSt))clulog (LOG_ERR ,"#40: Error replying to " "action request.\n" ); +break ; }/* Queue request */
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 [ $ret -eq 0 ]; then + touch /var/lock/subsys/rgmanager + fi + exit $rv ;; restart)
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/utils/clusvcadm.c +25 -2
@@ -153,7 +153,7 @@printf ("Resource Group Control Commands:\n" );printf (" %s -v Display version and exit\n" ,name);printf (" %s -d <group> Disable <group>\n" , name); -printf (" %s -e <group> Enable <group>\n" , +printf (" %s -e <group> Enable <group> on the local node\n" , name);printf (" %s -e <group> -m <member> Enable <group>" " on <member>\n" , name);
@@ -317,12 +317,31 @@fprintf (stderr,"Error receiving reply!\n" );return 1 ; } - +/* Decode */ swab_SmMessageSt (&msg);switch (msg.sm_data.d_ret) {case SUCCESS :printf ("success\n" ); + +/* Non-start/relo request: done */ +if (action !=RG_RELOCATE && action !=RG_ENABLE ) +break ; + +if (svctarget !=NODE_ID_NONE && + msg.sm_data.d_svcOwner != svctarget) { +/* Service running somewhere besides where requested */ +printf ("Warning: Service %s is running on %s " +"instead of %s\n" , svcname, +memb_id_to_name (membership, + msg.sm_data.d_svcOwner), +memb_id_to_name (membership, svctarget)); +break ; + } + +/* No node specified or service running where requested */ +printf ("Service %s is now running on %s\n" , svcname, +memb_id_to_name (membership, msg.sm_data.d_svcOwner));break ;case RG_EFAIL :printf ("failed\n" );
@@ -339,6 +358,10 @@case RG_EAGAIN :printf ("failed: Try again (resource groups locked)\n" );break ; +case RG_ERUN : +printf ("failed: Service is already running\n" ); +return 0 ; +break ;default :printf ("failed: unknown reason %d\n" , msg.sm_data.d_ret);break ;
rgmanager/src/utils/clustat.c +67 -42
224 lines not on this page · raw message
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/include/resgroup.h +9 -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,13 @@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_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