cluster/rgmanager ChangeLog include/resgroup.h ...
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2007-11-30 20:36:18
Modified files:
rgmanager : ChangeLog
rgmanager/include: resgroup.h reslist.h rgmanager/src/daemons: Makefile fo_domain.c groups.c main.c
reslist.c resrules.c restree.c rg_state.c test.c
Added files:
rgmanager/include: restart_counter.h rgmanager/src/daemons: restart_counter.c
Log message:
Merges from RHEL5 branch - round 2.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&r1=1.60&r2=1.61
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/restart_counter.h.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/resgroup.h.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/reslist.h.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/restart_counter.c.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/Makefile.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/fo_domain.c.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.c.diff?cvsroot=cluster&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/reslist.c.diff?cvsroot=cluster&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/restree.c.diff?cvsroot=cluster&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_state.c.diff?cvsroot=cluster&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/test.c.diff?cvsroot=cluster&r1=1.12&r2=1.13
rgmanager/ChangeLog +4 -2
@@ -1,6 +1,8 @@ 2007-11-30 Lon Hohberger <[email protected]> - * src/resources/*: Merge from RHEL5 branch. - * src/utils/*: Merge from RHEL5 branch. + * src/resources/*: Merge misc. updates from RHEL5 branch. + * src/utils/*: Merge misc. updates from RHEL5 branch. + * include/*.h, src/daemons/*: Merge status-counter patch + from RHEL5 branch. 2007-08-30 Lon Hohberger <[email protected]> * src/daemons/restree.c, rg_state.c: Fix tree-restart bug
rgmanager/include/restart_counter.h +12 -0
@@ -0,0 +1,12 @@ +#ifndef _RESTART_COUNTER_H +#define _RESTART_COUNTER_H + +typedef void *restart_counter_t ; + +int restart_add (restart_counter_t arg); +int restart_clear (restart_counter_t arg); +int restart_count (restart_counter_t arg); +restart_counter_t restart_init (time_t expire_timeout,int max_restarts); +int restart_cleanup (restart_counter_t arg); + +#endif
rgmanager/include/resgroup.h +2 -0
@@ -150,6 +150,8 @@int svc_freeze (char *svcName);int svc_unfreeze (char *svcName);int svc_migrate (char *svcName,int target); +int check_restart (char *svcName); +int rt_enqueue_request (const char *resgroupname,int request,msgctx_t *resp_ctx,int max,uint32_t target,int arg0,int arg1);
rgmanager/include/reslist.h +1 -0
@@ -126,6 +126,7 @@struct _rg_node *rn_child, *rn_parent;resource_t *rn_resource;resource_act_t *rn_actions; +restart_counter_t rn_restart_counter;int rn_state;/* State of this instance of rn_resource */ int rn_flags;int rn_last_status;
rgmanager/src/daemons/restart_counter.c +185 -0
185 lines not on this page · raw message
rgmanager/src/daemons/Makefile +3 -1
@@ -31,12 +31,14 @@ rg_queue.o \ rg_state.o \ rg_thread.o \ + restart_counter.o \ watchdog.o OBJS2= clurmtabd.o \ clurmtabd_lib.o -OBJS3= test-noccs.o +OBJS3= test-noccs.o \ + restart_counter.o OBJS4= dtest-noccs.o
rgmanager/src/daemons/fo_domain.c +1 -0
@@ -27,6 +27,7 @@#include <list.h> #include <clulog.h> #include <resgroup.h> +#include <restart_counter.h> #include <reslist.h> #include <ccs.h> #include <pthread.h>
rgmanager/src/daemons/groups.c +46 -0
64 lines not on this page · raw message
rgmanager/src/daemons/main.c +10 -4
@@ -166,6 +166,7 @@ old_membership =member_list (); new_ml =get_member_list (h); +memb_mark_down (new_ml,0 );for (x =0 ; x < new_ml->cml_count; x++) {
@@ -182,19 +183,25 @@ quorate =cman_is_listening (h, new_ml->cml_members[x].cn_nodeid, port); +if (quorate ==0 ) {clulog (LOG_DEBUG ,"Node %d is not listening\n" , new_ml->cml_members[x].cn_nodeid); new_ml->cml_members[x].cn_member =0 ; }else if (quorate <0 ) { +if (errno ==ENOTCONN ) { + new_ml->cml_members[x].cn_member =0 ; +break ; + }perror ("cman_is_listening" );usleep (50000 );continue ; } -#ifdef DEBUG -printf ("Node %d IS listening\n" , - new_ml->cml_members[x].cn_nodeid); + else { +printf ("Node %d IS listening\n" , + new_ml->cml_members[x].cn_nodeid); + }#endif break ; }while (1 );
@@ -202,7 +209,6 @@cman_finish (h);member_list_update (new_ml); -member_set_state (0 ,0 );/* Mark qdisk as dead */ /* * Handle nodes lost. Do our local node event first.
rgmanager/src/daemons/reslist.c +1 -0
@@ -26,6 +26,7 @@#include <sys/types.h> #include <sys/stat.h> #include <list.h> +#include <restart_counter.h> #include <reslist.h> #include <pthread.h> #ifndef NO_CCS
rgmanager/src/daemons/resrules.c +56 -27
105 lines not on this page · raw message
rgmanager/src/daemons/restree.c +40 -0
@@ -30,6 +30,7 @@#include <sys/types.h> #include <sys/stat.h> #include <list.h> +#include <restart_counter.h> #include <reslist.h> #include <pthread.h> #include <clulog.h>
@@ -432,6 +433,39 @@ } +static inline void +assign_restart_policy (resource_t *curres,resource_node_t *parent, +resource_node_t *node) +{ +char *val; +int max_restarts =0 ; +time_t restart_expire_time =0 ; + + node->rn_restart_counter =NULL ; + +if (!curres || !node) +return ; +if (parent)/* Non-parents don't get one for now */ +return ; + + val =res_attr_value (curres,"max_restarts" ); +if (!val) +return ; + max_restarts =atoi (val); +if (max_restarts <=0 ) +return ; + val =res_attr_value (curres,"restart_expire_time" ); +if (val) { + restart_expire_time = (time_t )expand_time (val); +if (!restart_expire_time) +return ; + } + + node->rn_restart_counter =restart_init (restart_expire_time, + max_restarts); +} + + static inline int do_load_resource(int ccsfd, char *base, resource_rule_t *rule,
@@ -514,6 +548,7 @@ node->rn_state =RES_STOPPED ; node->rn_flags =0 ; node->rn_actions = (resource_act_t *)act_dup (curres->r_actions); +assign_restart_policy (curres, parent, node);snprintf (tok,sizeof (tok),"%s/@__independent_subtree" , base);#ifndef NO_CCS
@@ -769,6 +804,11 @@destroy_resource_tree (&(*tree)->rn_child);list_remove (tree, node); + +if (node->rn_restart_counter) { +restart_cleanup (node->rn_restart_counter); + } +if (node->rn_actions){free (node->rn_actions); }
rgmanager/src/daemons/rg_state.c +14 -3
@@ -1350,7 +1350,8 @@ }if ((svcStatus.rs_state !=RG_STATE_STOPPING ) && - (svcStatus.rs_state !=RG_STATE_ERROR )) { + (svcStatus.rs_state !=RG_STATE_ERROR ) && + (svcStatus.rs_state !=RG_STATE_RECOVER )) {rg_unlock (&lockp);return 0 ; }
@@ -1829,8 +1830,10 @@* We got sent here from handle_start_req. * We're DONE. */ -if (request ==RG_START_RECOVER ) +if (request ==RG_START_RECOVER ) { +_svc_stop_finish (svcName,0 ,RG_STATE_STOPPED );return RG_EFAIL ; + }/* * All potential places for the service to start have been exhausted.
@@ -1839,7 +1842,7 @@ exhausted:if (!rg_locked ()) {clulog (LOG_WARNING , -"#70: Attempting to restart service %s locally.\n" , +"#70: Failed to relocate %s; restarting locally\n" , svcName);if (svc_start (svcName,RG_START_RECOVER ) ==0 ) { *new_owner = me;
@@ -2078,6 +2081,14 @@ new_owner); } +/* Check restart counter/timer for this resource */ +if (check_restart (svcName) >0 ) { +clulog (LOG_NOTICE ,"Restart threshold for %s exceeded; " +"attempting to relocate\n" , svcName); +return handle_relocate_req (svcName,RG_START_RECOVER ,-1 , + new_owner); + } +return handle_start_req (svcName,RG_START_RECOVER , new_owner); }
rgmanager/src/daemons/test.c +1 -0
@@ -25,6 +25,7 @@#include <sys/types.h> #include <sys/stat.h> #include <list.h> +#include <restart_counter.h> #include <reslist.h> #include <pthread.h> #include <depends.h>