cluster/rgmanager ChangeLog include/res-ocf.h ...
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: lhh at sourceware.org 2007-07-31 17:54:55
Modified files:
rgmanager : ChangeLog
rgmanager/include: res-ocf.h reslist.h rgmanager/src/clulib: rg_strings.c rgmanager/src/daemons: groups.c reslist.c resrules.c restree.c
test.c
rgmanager/src/resources: ra-api-1-modified.dtd service.sh vm.sh
Log message:
Fix bug #248727
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.31.2.22&r2=1.31.2.23
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/res-ocf.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.16.1&r2=1.1.16.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/reslist.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/src/clulib/rg_strings.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.4&r2=1.5.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.25.2.10&r2=1.25.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/reslist.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.14.2.3&r2=1.14.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.16.2.6&r2=1.16.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/restree.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.23.2.8&r2=1.23.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/test.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.4&r2=1.6.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/ra-api-1-modified.dtd.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/service.sh.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7.2.4&r2=1.7.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/vm.sh.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.5&r2=1.1.2.6
rgmanager/ChangeLog +20 -0
@@ -1,3 +1,23 @@ +2007-07-31 Lon Hohberger <[email protected]> + * general: Make VMs not change state when added/removed from the + cluster config or bounce services/VMs when minor config changes + are made. (#248727) + * include/res-ocf.h: Add reconfigure operation + * include/reslist.h: Add flags allowing reconfigurable options in + resource agent metadata, and per-agent flags which allow resources + to be added w/o initialization / removed w/o kill. + * src/clulib/rg_strings.c: Add string definition for reconfigure op + * src/daemons/groups.c: Allow no-init-on-add and no-kill-on-delete + flags to work + * src/daemons/reslist.c: Allow resource comparison to take into + account reconfig flags and return a new value if the resource is + reconfigurable + * src/daemons/resrules.c: Code to support new flags + * src/daemons/restree.c: Code to support reconfiguration operation + * src/daemons/test.c: Code to support testing new reconfig ops and + behaviors + * src/resources/*: Add new flags to service and VM resource agents. + 2007-07-24 Lon Hohberger <[email protected]> * general: make threads exit with pthread_exit() so we can wrap/track them. Add internal statedump (SIGUSR1) support.
rgmanager/include/res-ocf.h +1 -0
@@ -62,5 +62,6 @@#define RS_META_DATA (11)#define RS_VALIDATE (12)#define RS_MIGRATE (13) +#define RS_RECONFIG (14)#endif
rgmanager/include/reslist.h +14 -4
@@ -25,10 +25,11 @@#include <libxml/xpath.h> -#define RA_PRIMARY (1<<0) -#define RA_UNIQUE (1<<1) -#define RA_REQUIRED (1<<2) -#define RA_INHERIT (1<<3) +#define RA_PRIMARY (1<<0)/** Primary key */ +#define RA_UNIQUE (1<<1)/** Unique for given type */ +#define RA_REQUIRED (1<<2)/** Required (or an error if not present */ +#define RA_INHERIT (1<<3)/** Inherit a parent resource's attr */ +#define RA_RECONFIG (1<<4)/** Allow inline reconfiguration */ #define RF_INLINE (1<<0)#define RF_DEFINED (1<<1)
@@ -37,6 +38,15 @@#define RF_COMMON (1<<4)/** " */ #define RF_INDEPENDENT (1<<5)/** Define this for a resource if it is otherwise an independent subtree */ +#define RF_RECONFIG (1<<6) + +#define RF_INIT (1<<7)/** Resource rule: Initialize this resource +class on startup */ +#define RF_DESTROY (1<<8)/** Resource rule flag: Destroy this +resource class if you delete it from +the configuration */ + +#define RES_STOPPED (0)#define RES_STARTED (1)
rgmanager/src/clulib/rg_strings.c +1 -0
@@ -106,6 +106,7 @@ {RS_META_DATA, "meta-data"}, /* printenv */ {RS_VALIDATE, "validate-all"}, {RS_MIGRATE, "migrate"}, + {RS_RECONFIG, "reconfig"}, {0 , NULL} };
rgmanager/src/daemons/groups.c +32 -2
@@ -1222,6 +1222,7 @@do_condstops (void) {resource_node_t *curr; +struct dlm_lksb lockp;rg_state_t svcblk;int need_kill;char rg[64 ];
@@ -1249,6 +1250,24 @@clulog (LOG_DEBUG ,"Removing %s\n" , rg); } +if (!curr->rn_child && ((curr->rn_resource->r_rule->rr_flags & +RF_DESTROY ) ==0 ) &&group_migratory (rg,0 ) && + need_kill ==1 ) { +/* Do something smart here: flip state? */ +clulog (LOG_NOTICE , +"%s removed from the config, but I am not stopping it.\n" , + rg); +if (rg_lock (rg, &lockp) !=0 ) +continue ; +if (get_rg_state (rg, &svcblk) <0 ) + goto cont; + svcblk.rs_state =RG_STATE_DISABLED ; +set_rg_state (rg, &svcblk); +cont: +rg_unlock (&lockp); +continue ; + } +rt_enqueue_request (rg, need_kill ?RG_DISABLE :RG_CONDSTOP ,NULL ,0 ,0 ,0 ,0 );
@@ -1282,7 +1301,8 @@/* New RG. We'll need to initialize it. */ need_init =0 ; -if (curr->rn_resource->r_flags &RF_NEEDSTART ) +if (!(curr->rn_resource->r_flags &RF_RECONFIG ) && + (curr->rn_resource->r_flags &RF_NEEDSTART )) need_init =1 ;if (!need_init) {
@@ -1305,7 +1325,17 @@if (need_init) { ++new_groups; -clulog (LOG_DEBUG ,"Initializing %s\n" , rg); +clulog (LOG_NOTICE ,"Initializing %s\n" , rg); + } + +if (!curr->rn_child && ((curr->rn_resource->r_rule->rr_flags & +RF_INIT ) ==0 ) &&group_migratory (rg,0 ) && + need_init ==1 ) { +/* Do something smart here? */ +clulog (LOG_NOTICE , +"%s was added to the config, but I am not initializing it.\n" , + rg); +continue ; } rt_enqueue_request(rg, need_init ? RG_INIT : RG_CONDSTART,
rgmanager/src/daemons/reslist.c +44 -11
122 lines not on this page · raw message
rgmanager/src/daemons/resrules.c +75 -12
123 lines not on this page · raw message
rgmanager/src/daemons/restree.c +32 -5
@@ -1186,9 +1186,15 @@/* Start starts before children */ if (me && (op ==RS_START )) { - node->rn_flags &= ~RF_NEEDSTART ; - rv =res_exec (node, op,NULL ,0 ); +if (node->rn_flags &RF_RECONFIG && + realop ==RS_CONDSTART ) { + rv =res_exec (node,RS_RECONFIG ,NULL ,0 ); + op = realop;/* reset to CONDSTART */ + }else { + rv =res_exec (node, op,NULL ,0 ); + } + node->rn_flags &= ~(RF_NEEDSTART |RF_RECONFIG );if (rv !=0 ) { node->rn_state =RES_FAILED ;return SFL_FAILURE ;
@@ -1408,6 +1414,7 @@ resource_delta(resource_t **leftres, resource_t **rightres) {resource_t *lc, *rc; +int ret; list_do(leftres, lc) { rc = find_resource_by_ref(rightres, lc->r_rule->rr_type,
@@ -1420,10 +1427,25 @@ }/* Ok, see if the resource is the same */ -if (rescmp (lc, rc) ==0 ) { + ret =rescmp (lc, rc); +if (ret ==0 ) { rc->r_flags |=RF_COMMON ;continue ; } + +if (ret ==2 ) { +/* return of 2 from rescmp means +the two resources differ only +by reconfigurable bits */ +/* Do nothing on condstop phase; +do a "reconfig" instead of +"start" on conststart phase */ + rc->r_flags |=RF_COMMON ; + rc->r_flags |=RF_NEEDSTART ; + rc->r_flags |=RF_RECONFIG ; +continue ; + } + rc->r_flags |=RF_COMMON ;/* Resource has changed. Flag it. */
@@ -1485,12 +1507,17 @@or is new), then we don't really care about its children. */ +if (rn->rn_resource->r_flags &RF_NEEDSTART ) { rn->rn_flags |=RF_NEEDSTART ; -continue ; +if ((rn->rn_resource->r_flags &RF_RECONFIG ) ==0 ) +continue ; } -if (rc ==0 ) { +if (rc ==0 || rc ==2 ) { +if (rc ==2 ) + rn->rn_flags |=RF_NEEDSTART |RF_RECONFIG ; +/* Ok, same resource. Recurse. */ ln->rn_flags |=RF_COMMON ; rn->rn_flags |=RF_COMMON ;
rgmanager/src/daemons/test.c +99 -1
124 lines not on this page · raw message
rgmanager/src/resources/ra-api-1-modified.dtd +2 -2
@@ -24,6 +24,7 @@ name CDATA #REQUIRED primary (1|0) "0" required (1|0) "0" + reconfig (1|0) "0" inherit CDATA "" unique (1|0) "0" reconfig (1|0) "0">
@@ -43,7 +44,7 @@ <!ELEMENT action EMPTY> <!ATTLIST action - name (start|stop|recover|status|reconfig|monitor|reload|meta-data|verify-all|migrate) #REQUIRED + name (start|stop|recover|status|reconfig|monitor|reload|meta-data|verify-all|migrate|reconfig) #REQUIRED timeout CDATA #REQUIRED interval CDATA #IMPLIED start-delay CDATA #IMPLIED
@@ -56,7 +57,6 @@ <!ELEMENT attributes EMPTY> <!ATTLIST attributes - root (1|0) "0" maxinstances CDATA "0"> <!ELEMENT child EMPTY>
rgmanager/src/resources/service.sh +10 -6
@@ -56,7 +56,7 @@ <content type="string"/> </parameter> - <parameter name="domain"> + <parameter name="domain" reconfig="1"> <longdesc lang="en"> Fail over domains define lists of cluster members to try in the event that a resource group fails.
@@ -67,7 +67,7 @@ <content type="string"/> </parameter> - <parameter name="autostart"> + <parameter name="autostart" reconfig="1"> <longdesc lang="en"> If set to yes, this resource group will automatically be started after the cluster forms a quorum. If set to no, this resource
@@ -80,7 +80,7 @@ <content type="boolean"/> </parameter> - <parameter name="hardrecovery"> + <parameter name="hardrecovery" reconfig="1"> <longdesc lang="en"> If set to yes, the last owner will reboot if this resource group fails to stop cleanly, thus allowing the resource
@@ -128,7 +128,7 @@ <content type="boolean"/> </parameter> - <parameter name="recovery"> + <parameter name="recovery" reconfig="1"> <longdesc lang="en"> This currently has three possible options: "restart" tries to restart failed parts of this resource group locally before
@@ -164,10 +164,11 @@ <action name="status" timeout="5" interval="1h"/> <action name="monitor" timeout="5" interval="1h"/> + <action name="reconfig" timeout="5"/> <action name="recover" timeout="5"/> <action name="reload" timeout="5"/> <action name="meta-data" timeout="5"/> - <action name="verify-all" timeout="5"/> + <action name="validate-all" timeout="5"/> </actions> <special tag="rgmanager">
@@ -224,7 +225,10 @@ meta_data exit 0 ;; - verify-all) + validate-all) + exit 0 + ;; + reconfig) exit 0 ;; *)
rgmanager/src/resources/vm.sh +10 -6
@@ -51,7 +51,7 @@ <content type="string"/> </parameter> - <parameter name="domain"> + <parameter name="domain" reconfig="1"> <longdesc lang="en"> Fail over domains define lists of cluster members to try in the event that the host of the virtual machine
@@ -63,7 +63,7 @@ <content type="string"/> </parameter> - <parameter name="autostart"> + <parameter name="autostart" reconfig="1"> <longdesc lang="en"> If set to yes, this resource group will automatically be started after the cluster forms a quorum. If set to no, this virtual
@@ -193,12 +193,16 @@ <action name="migrate" timeout="10m"/> <action name="meta-data" timeout="5"/> - <action name="verify-all" timeout="5"/> + <action name="validate-all" timeout="5"/> </actions> <special tag="rgmanager"> - <attributes maxinstances="1"/> + <!-- Destroy_on_delete / init_on_add are currently only + supported for migratory resources (no children + and the 'migrate' action; see above. Do not try this + with normal services --> + <attributes maxinstances="1" destroy_on_delete="0" init_on_add="0"/> </special> </resource-agent> EOT
@@ -417,12 +421,12 @@ meta_data exit 0 ;; - verify-all) + validate-all) verify_all exit $? ;; *) - echo "usage: $0 {start|stop|restart|status|reload|reconfig|meta-data|verify-all}" + echo "usage: $0 {start|stop|restart|status|reload|reconfig|meta-data|validate-all}" exit 1 ;; esac