cluster/rgmanager ChangeLog include/resgroup.h ...
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2006-09-01 19:02:22
Modified files:
rgmanager : ChangeLog
rgmanager/include: resgroup.h vf.h rgmanager/src/clulib: rg_strings.c vft.c rgmanager/src/daemons: groups.c main.c rgmanager/src/utils: clustat.c clusvcadm.c
Log message:
2006-09-01 Lon Hohberger <[email protected]>
* include/resgroup.h: Add proto for rg_strerror
* include/vf.h: Add proto for vf_invalidate (flushes vf cache)
* src/clulib/rg_strings.c: Add rg_strerror function, define human-readable strings for rgmanager error values
* src/clulib/vft.c: Add vf_invalidate (separate from vf_shutdown)
* src/daemons/groups.c: Fix obvious logic error
* src/daemons/main.c: Fix rg_doall() message during loss of quorum. Invalidate local VF cache and kill resource configurations on loss of quorum (#202497). Send RG_EQUORUM back to clustat/clusvcadm so that they report why they can't get information. Don't queue status checks if we've lost quorum. Add command line parameter to disable internal crash watchdog
* src/utils/clustat.c, clusvcadm.c: Handle SIGPIPE, and produce useful errors if possible.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/resgroup.h.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/vf.h.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/rg_strings.c.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/vft.c.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.c.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clustat.c.diff?cvsroot=cluster&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clusvcadm.c.diff?cvsroot=cluster&r1=1.11&r2=1.12
rgmanager/ChangeLog +22 -0
@@ -1,3 +1,25 @@ +2006-09-01 Lon Hohberger <[email protected]> + * include/resgroup.h: Add proto for rg_strerror + * include/vf.h: Add proto for vf_invalidate (flushes vf cache) + * src/clulib/rg_strings.c: Add rg_strerror function, define + human-readable strings for rgmanager error values + * src/clulib/vft.c: Add vf_invalidate (separate from vf_shutdown) + * src/daemons/groups.c: Fix obvious logic error + * src/daemons/main.c: Fix rg_doall() message during loss of quorum. + Invalidate local VF cache and kill resource configurations on + loss of quorum (#202497). Send RG_EQUORUM back to clustat/clusvcadm + so that they report why they can't get information. Don't queue + status checks if we've lost quorum. Add command line parameter to + disable internal crash watchdog + * src/utils/clustat.c, clusvcadm.c: Handle SIGPIPE, and produce + useful errors if possible. + +2006-08-31 Marek Gr??c <[email protected]> + * src/daemons/restree.c: Fix #203720. Do not run backup copies (ends + with ~) of resource agents. + * src/resources/apache.*, mysql.*: Add Apache & MySQL resource agents + * src/resources/utils/*: Add utility scripts for resource agents + 2006-08-21 Lon Hohberger <[email protected]> * src/daemons/main.c: Fix #202500 - simultaneous starts confuse rgmanager. This happened due to the fact that rgmanager was not
rgmanager/include/resgroup.h +3 -0
@@ -174,6 +174,9 @@#define RG_YES 1#define RG_NO 2 +char *rg_strerror (int val); + +/* * Fail-over domain states */
rgmanager/include/vf.h +1 -0
@@ -170,6 +170,7 @@* VF Stuff. VF only talks to peers. */ int vf_init (int ,uint16_t ,vf_vote_cb_t ,vf_commit_cb_t ); +int vf_invalidate (void );int vf_shutdown (void );/*
rgmanager/src/clulib/rg_strings.c +34 -0
@@ -16,6 +16,39 @@Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <resgroup.h> + +struct {int val;char *str; } rg_error_strings[] = { + {RG_EQUORUM ,"Operation requires quorum" }, + {RG_EINVAL ,"Invalid operation for resource" }, + {RG_EDEPEND ,"Operation violates dependency rule" }, + {RG_EAGAIN ,"Temporary failure; try again" }, + {RG_EDEADLCK ,"Operation would cause a deadlock" }, + {RG_ENOSERVICE ,"Service does not exist" }, + {RG_EFORWARD ,"Service not mastered locally" }, + {RG_EABORT ,"Aborted; service failed" }, + {RG_EFAIL ,"Failure" }, + {RG_ESUCCESS ,"Success" }, + {RG_YES ,"Yes" }, + {RG_NO ,"No" }, + {0 ,NULL } +}; + + +char *rg_strerror (int err) +{ +int x; + +for (x =0 ; rg_error_strings[x].str !=NULL ; x++) { +if (rg_error_strings[x].val == err) { +return rg_error_strings[x].str; + } + } + +return "Unknown" ; +} + +const char *rg_state_strings[] = {"stopped" ,"starting" ,
@@ -51,3 +84,4 @@"user stop" , "" }; +
rgmanager/src/clulib/vft.c +24 -10
@@ -935,22 +935,13 @@ } -/** -Shut down VF -*/ int -vf_shutdown (void ) +vf_invalidate (void ) {key_node_t *c_key;view_node_t *c_jv;commit_node_t *c_cn; -pthread_mutex_lock (&vf_mutex); - vf_thread_ready =0 ; -pthread_cancel (vf_thread); -pthread_join (vf_thread,NULL ); - _port =0 ; - _node_id = (int )-1 ;pthread_mutex_lock (&key_list_mutex);while ((c_key = key_list) !=NULL ) {
@@ -974,6 +965,29 @@ }pthread_mutex_unlock (&key_list_mutex); +return 0 ; +} + + +/** +Shut down VF +*/ +int +vf_shutdown (void ) +{ +key_node_t *c_key; +view_node_t *c_jv; +commit_node_t *c_cn; + +pthread_mutex_lock (&vf_mutex); + vf_thread_ready =0 ; +pthread_cancel (vf_thread); +pthread_join (vf_thread,NULL ); + _port =0 ; + _node_id = (int )-1 ; + +vf_invalidate (); +pthread_mutex_unlock (&vf_mutex);return 0 ;
rgmanager/src/daemons/groups.c +1 -1
@@ -273,7 +273,7 @@* local start. */ if (svcStatus->rs_state ==RG_STATE_STARTED && - svcStatus->rs_owner == mp->cn_nodeid) + svcStatus->rs_owner != mp->cn_nodeid)return ;if (svcStatus->rs_state ==RG_STATE_DISABLED )
rgmanager/src/daemons/main.c +18 -7
@@ -123,7 +123,13 @@rg_set_inquorate ();member_list_update (NULL );/* Clear member list */ rg_lockall (L_SYS ); -rg_doall (RG_INIT ,1 ,"Emergency stop of %s" ); +rg_doall (RG_INIT ,1 ,"Emergency stop of %s\n" ); +#ifndef USE_OPENAIS +clulog (LOG_DEBUG ,"Invalidating local VF cache\n" ); +vf_invalidate (); +#endif +clulog (LOG_DEBUG ,"Flushing resource group cache\n" ); +kill_resource_groups ();rg_set_uninitialized ();return -1 ; }else if (!rg_quorate ()) {
@@ -131,7 +137,7 @@rg_set_quorate ();rg_unlockall (L_SYS );rg_unlockall (L_USER ); -clulog (LOG_NOTICE ,"Quorum Formed\n" ); +clulog (LOG_NOTICE ,"Quorum Regained\n" ); } old_membership =member_list ();
@@ -562,7 +568,7 @@case M_STATECHANGE :msg_receive (ctx,NULL ,0 ,0 );clulog (LOG_DEBUG ,"Membership Change Event\n" ); -if (rg_quorate () && running) { +if (running) {rg_unlockall (L_SYS );membership_update (); }
@@ -644,6 +650,7 @@ }if (!rg_initialized ()) { +msg_send_simple (newctx,RG_FAIL ,RG_EQUORUM ,0 );msg_close (newctx);msg_free_ctx (newctx);continue ;
@@ -651,6 +658,7 @@if (!rg_quorate ()) {printf ("Dropping connect: NO QUORUM\n" ); +msg_send_simple (newctx,RG_FAIL ,RG_EQUORUM ,0 );msg_close (newctx);msg_free_ctx (newctx); }
@@ -668,7 +676,7 @@return 0 ;/* No new messages. Drop in the status check requests. */ -if (n ==0 ) { +if (n ==0 &&rg_quorate ()) {do_status_checks ();return 0 ; }
@@ -805,15 +813,18 @@ main(int argc, char **argv) { int rv; -char foreground =0 ; +char foreground =0 , wd =1 ;cman_node_t me;msgctx_t *cluster_ctx;msgctx_t *local_ctx;pthread_t th;cman_handle_t clu =NULL ; -while ((rv =getopt (argc, argv,"fd" )) !=EOF ) { +while ((rv =getopt (argc, argv,"wfd" )) !=EOF ) {switch (rv) { +case 'w' : + wd =0 ; +break ;case 'd' : debug =1 ;break ;
@@ -834,7 +845,7 @@if (!foreground && (geteuid () ==0 )) {daemon_init (argv[0 ]); -if (!debug && !watchdog_init ()) +if (wd && !debug && !watchdog_init ())clulog (LOG_NOTICE ,"Failed to start watchdog\n" ); }
rgmanager/src/utils/clustat.c +12 -1
@@ -10,6 +10,7 @@#include <termios.h> #include <ccs.h> #include <libcman.h> +#include <signal.h> #ifdef HAVE_CONFIG_H #include <config.h>
@@ -46,7 +47,7 @@ rg_state_list(int local_node_id, int fast) {msgctx_t ctx; -int max, n, x; +int max =0 , n, x;rg_state_list_t *rsl =NULL ;generic_msg_hdr *msgp =NULL ;rg_state_msg_t *rsmp =NULL ;
@@ -91,6 +92,7 @@ } n =msg_receive_simple (&ctx, &msgp, tv.tv_sec); +if (n <0 ) {if (errno ==EAGAIN )continue ;
@@ -109,6 +111,13 @@swab_generic_msg_hdr (msgp); +if (msgp->gh_command ==RG_FAIL ) { +printf ("Service states unavailable: %s\n" , +rg_strerror (msgp->gh_arg1)); +msg_close (&ctx); +return NULL ; + } +if (msgp->gh_command ==RG_SUCCESS ) {free (msgp);break ;
@@ -736,6 +745,8 @@return 1 ; } +signal (SIGPIPE ,SIG_IGN ); +/* Connect & grab all our info */ ch =cman_init (NULL );
rgmanager/src/utils/clusvcadm.c +13 -34
79 lines not on this page · raw message