cluster/rgmanager TODO include/msgsimple.h inc ...
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2006-07-19 18:43:32
Modified files:
rgmanager : TODO
rgmanager/include: msgsimple.h resgroup.h reslist.h rg_queue.h rgmanager/src/daemons: fo_domain.c groups.c resrules.c restree.c
rg_queue.c rg_state.c rg_thread.c test.c
rgmanager/src/resources: ra-api-1-modified.dtd xenvm.sh rgmanager/src/utils: Makefile clusvcadm.c
Log message:
Add preliminary live-migration support (e.g. for Xen for FC6
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/TODO.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/msgsimple.h.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/resgroup.h.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/reslist.h.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/rg_queue.h.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/fo_domain.c.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.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.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/restree.c.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_queue.c.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_state.c.diff?cvsroot=cluster&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_thread.c.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/test.c.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/ra-api-1-modified.dtd.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/xenvm.sh.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/Makefile.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clusvcadm.c.diff?cvsroot=cluster&r1=1.9&r2=1.10
rgmanager/TODO +1 -0
@@ -2,3 +2,4 @@ can manually migrate Xen VMs to other nodes without telling the cluster about it. That is, the cluster should be able to acquire running VMs and update its state accordingly. +* Test against a working Xen build and shake out bugs
rgmanager/include/msgsimple.h +3 -4
@@ -11,7 +11,7 @@uint32_t gh_command;uint32_t gh_arg1;uint32_t gh_arg2; -/* XXX alignment issue on ia64 */ +uint32_t gh_arg3; } generic_msg_hdr;#define swab_generic_msg_hdr (ptr)\
@@ -29,9 +29,8 @@char d_svcName[64 ];uint32_t d_action;uint32_t d_svcState; -uint64_t d_svcOwner; +uint32_t d_svcOwner;int32_t d_ret; -uint32_t d_pad; } sm_data; } SmMessageSt;
@@ -40,7 +39,7 @@swab_generic_msg_hdr (&((ptr)->sm_hdr));\swab32 ((ptr)->sm_data.d_action);\swab32 ((ptr)->sm_data.d_svcState);\ -swab64 ((ptr)->sm_data.d_svcOwner);\ +swab32 ((ptr)->sm_data.d_svcOwner);\swab32 ((ptr)->sm_data.d_ret);\ }
rgmanager/include/resgroup.h +21 -21
91 lines not on this page · raw message
rgmanager/include/reslist.h +5 -1
@@ -53,6 +53,10 @@#define RS_RECOVER (7)#define RS_CONDSTART (8)/** Start if flagged with RF_NEEDSTART */ #define RS_CONDSTOP (9)/** STOP if flagged with RF_NEEDSTOP */ +#define RS_MONITOR (10) +#define RS_META_DATA (11) +#define RS_VALIDATE (12) +#define RS_MIGRATE (13)#ifndef SHAREDIR
@@ -100,7 +104,7 @@char * rr_type;char * rr_agent;char * rr_version;/** agent XML spec version; OCF-ism */ -int rr_root; +int rr_flags;int rr_maxrefs;resource_attr_t * rr_attrs;resource_child_t * rr_childtypes;
rgmanager/include/rg_queue.h +3 -2
@@ -16,9 +16,10 @@uint32_t rr_request;/** Request */ uint32_t rr_errorcode;/** Error condition */ uint32_t rr_orig_request;/** Original request */ -uint64_t rr_target;/** Target node */ +uint32_t rr_target;/** Target node */ uint32_t rr_arg0;/** Integer argument */ uint32_t rr_arg1;/** Integer argument */ +uint32_t rr_arg3;/** Integer argument */ uint32_t rr_line;/** Line no */ msgctx_t * rr_resp_ctx;/** FD to send response */ char *rr_file;/** Who made req */
@@ -28,7 +29,7 @@int _rq_queue_request (request_t **queue,char *name,uint32_t request,uint32_t err,uint32_t oldreq,msgctx_t *ctx,time_t when, -uint64_t target,uint32_t arg0,uint32_t arg1,char *file, +uint32_t target,uint32_t arg0,uint32_t arg1,char *file,int line); #define rq_queue_request(queue, name, request, err, oldreq,\
rgmanager/src/daemons/fo_domain.c +3 -1
@@ -333,8 +333,10 @@fod_t *fod =NULL ;int found =0 ;int owned_by_node =0 , started =0 , no_owner =0 ; +#ifndef NO_CCS rg_state_t svc_state;struct dlm_lksb lockp; +#endif ENTER ();
@@ -408,7 +410,7 @@RETURN (FOD_BEST ); } -if (get_rg_state (rg_name, &svc_state) ==FAIL ) { +if (get_rg_state (rg_name, &svc_state) ==RG_EFAIL ) {/* * Couldn't get the service state, thats odd */
rgmanager/src/daemons/groups.c +91 -10
161 lines not on this page · raw message
rgmanager/src/daemons/resrules.c +3 -39
82 lines not on this page · raw message
rgmanager/src/daemons/restree.c +15 -15
@@ -70,7 +70,8 @@"condstop" ,"monitor" ,"meta-data" ,/* printenv */ - "validate-all" +"validate-all" , + "migrate" };
@@ -215,14 +216,13 @@Allocate and fill an environment variable array. @param node Node in resource tree to use for parameters -@param op Operation (start/stop/status/monitor/etc.) @param depth Depth (status/monitor/etc.) @return Newly allocated environment array or NULL if one could not be formed. @see kill_env res_exec add_ocf_stuff */ static char ** -build_env (resource_node_t *node,int op,int depth) +build_env (resource_node_t *node,int depth) {resource_t *res = node->rn_resource;char **env;
@@ -327,7 +327,7 @@@see build_env */ int -res_exec (resource_node_t *node,int op,int depth) +res_exec (resource_node_t *node,const char *op,const char *arg,int depth) {int childpid, pid;int ret =0 ;
@@ -339,7 +339,7 @@return 0 ;#ifdef DEBUG - env =build_env (node, op); + env =build_env (node, depth);if (!env)return -errno;#endif
@@ -360,7 +360,7 @@#endif #ifndef DEBUG - env =build_env (node, op, depth); + env =build_env (node, depth);#endif if (!env)
@@ -375,7 +375,10 @@restore_signals (); -execle (fullpath, fullpath, res_ops[op],NULL , env); +if (arg) +execle (fullpath, fullpath, op, arg,NULL , env); +else +execle (fullpath, fullpath, op,NULL , env); }#ifdef DEBUG
@@ -395,7 +398,7 @@if (ret) {clulog (LOG_NOTICE ,"%s on %s \"%s\" returned %d (%s)\n" , - res_ops[op], res->r_rule->rr_type, + op, res->r_rule->rr_type, res->r_attrs->ra_value, ret,ocf_strerror (ret)); }
@@ -584,9 +587,6 @@/* Find and build the list of root nodes */ list_do(rulelist, curr) { -if (!curr->rr_root) -continue ; -build_tree (ccsfd, &root,NULL , curr, rulelist, reslist, tok); }while (!list_done (rulelist, curr));
@@ -847,7 +847,7 @@return 0 ; node->rn_actions[idx].ra_last = now; -if ((x =res_exec (node,RS_STATUS , +if ((x =res_exec (node, res_ops[RS_STATUS ],NULL , node->rn_actions[idx].ra_depth)) ==0 )return 0 ;
@@ -855,7 +855,7 @@return x;/* Strange/failed status. Try to recover inline. */ -if ((x =res_exec (node,RS_RECOVER ,0 )) ==0 ) +if ((x =res_exec (node, res_ops[RS_RECOVER ],NULL ,0 )) ==0 )return 0 ;return x;
@@ -1005,7 +1005,7 @@if (me && (op ==RS_START )) { node->rn_flags &= ~RF_NEEDSTART ; - rv =res_exec (node, op,0 ); + rv =res_exec (node, res_ops[op],NULL ,0 );if (rv !=0 ) { node->rn_state =RES_FAILED ;return rv;
@@ -1029,7 +1029,7 @@/* Stop/status/etc stops after children have stopped */ if (me && (op ==RS_STOP )) { node->rn_flags &= ~RF_NEEDSTOP ; - rv =res_exec (node, op,0 ); + rv =res_exec (node, res_ops[op],NULL ,0 );if (rv !=0 ) { node->rn_state =RES_FAILED ;
rgmanager/src/daemons/rg_queue.c +1 -1
@@ -26,7 +26,7 @@int _rq_queue_request (request_t **queue,char *name,uint32_t request,uint32_t err,uint32_t oldreq,msgctx_t *ctx,time_t when, -uint64_t target,uint32_t arg0,uint32_t arg1,char *file, +uint32_t target,uint32_t arg0,uint32_t arg1,char *file,int line) {request_t *req;
rgmanager/src/daemons/rg_state.c +161 -62
518 lines not on this page · raw message
rgmanager/src/daemons/rg_thread.c +22 -2
@@ -48,7 +48,7 @@static resthread_t *find_resthread_byname (const char *resgroupname);static int spawn_if_needed (const char *resgroupname);int rt_enqueue_request (const char *resgroupname,int request, -msgctx_t *response_ctx,int max,uint64_t target, +msgctx_t *response_ctx,int max,uint32_t target,int arg0,int arg1);
@@ -248,6 +248,26 @@ ret =RG_NONE ;break ; +case RG_MIGRATE : + error =svc_migrate (myname, req->rr_target); + +if (error ==0 ) { + ret =RG_SUCCESS ; + +pthread_mutex_lock (&my_queue_mutex); +purge_status_checks (&my_queue); +pthread_mutex_unlock (&my_queue_mutex); + }else if (error ==RG_EFORWARD ) { + ret =RG_NONE ; +break ; + }else { +/* +* Bad news. +*/ + ret =RG_FAIL ; + } +break ; +case RG_INIT :/* Stop without changing shared state of it */ error =group_op (myname,RG_STOP );
@@ -551,7 +571,7 @@int rt_enqueue_request (const char *resgroupname,int request,msgctx_t *response_ctx, -int max,uint64_t target,int arg0,int arg1) +int max,uint32_t target,int arg0,int arg1) {request_t *curr;int count =0 , ret;
rgmanager/src/daemons/test.c +1 -1
@@ -90,7 +90,7 @@conf_setconfig (argv[1 ]); ccsfd =ccs_lock (); -if (ccsfd ==FAIL ) { +if (ccsfd <0 ) {printf ("Error parsing %s\n" , argv[1 ]); goto out; }
rgmanager/src/resources/ra-api-1-modified.dtd +1 -1
@@ -42,7 +42,7 @@ <!ELEMENT action EMPTY> <!ATTLIST action - name (start|stop|recover|status|monitor|reload|meta-data|verify-all) #REQUIRED + name (start|stop|recover|status|monitor|reload|meta-data|verify-all|migrate) #REQUIRED timeout CDATA #REQUIRED interval CDATA #IMPLIED start-delay CDATA #IMPLIED
rgmanager/src/resources/xenvm.sh +14 -0
@@ -181,6 +181,7 @@ <!-- Suspend: if available, suspend this resource instead of doing a full stop. --> <!-- <action name="suspend" timeout="10m"/> --> + <action name="migrate" timeout="10m"/> <action name="meta-data" timeout="5"/> <action name="verify-all" timeout="5"/>
@@ -403,6 +404,15 @@ fi } + +migrate() +{ + declare target=$1 + + # XXX TODO; requires working Xen + return 1 +} + # # A Resource group is abstract, but the OCF RA API doesn't allow for abstract # resources, so here it is.
@@ -427,6 +437,10 @@ status exit $? ;; + migrate) + migrate $2 # Send Xen VM to this node + exit $? + ;; reload) exit 0 ;;
rgmanager/src/utils/Makefile +3 -3
@@ -20,9 +20,9 @@ CFLAGS+= -g -Wstrict-prototypes -Wshadow -fPIC -D_GNU_SOURCE -CFLAGS+= -L${libdir} -DPACKAGE_VERSION=\"${RELEASE}\" +CFLAGS+= -DPACKAGE_VERSION=\"${RELEASE}\" -LDFLAGS+= -L../../../cman/lib -L../../../ccs/lib -lcman -lpthread -ldl -lncurses -L../clulib -lclulib -lccs +LDFLAGS+= -L${libdir} -L../../../cman/lib -L../../../ccs/lib -lcman -lpthread -ldl -lncurses -L../clulib -lclulib -lccs TARGETS=clubufflush clufindhostname clustat clusvcadm clulog clunfslock all: ${TARGETS}
@@ -44,7 +44,7 @@ $(CC) -o $@ $^ $(INLUDE) $(CFLAGS) $(LDFLAGS) clufindhostname: clufindhostname.o - $(CC) -o $@ $^ $(INLUDE) $(CFLAGS) $(LDFLAGS) + $(CC) -o $@ $^ $(INLUDE) $(CFLAGS) clustat: clustat.o $(CC) -o $@ $^ $(INLUDE) $(CFLAGS) $(LDFLAGS)
rgmanager/src/utils/clusvcadm.c +15 -8
@@ -158,6 +158,9 @@ " on <member>\n", name);printf (" %s -r <group> -m <member> Relocate <group> [to <member>]\n" , name); +printf (" %s -M <group> -m <member> Migrate <group> [to <member>]\n" , + name); +printf (" (e.g. for live migration of Xen VMs)\n" );printf (" %s -q Quiet operation\n" , name);printf (" %s -R <group> Restart a group in place.\n" , name);
@@ -186,7 +189,7 @@SmMessageSt msg;int action =RG_STATUS ;int node_specified =0 ; -int msgtarget, me, svctarget =0 ; +int me, svctarget =0 ;char *actionstr =NULL ;cluster_member_list_t *membership;
@@ -224,6 +227,12 @@ action =RG_RELOCATE ; svcname = optarg;break ; +case 'M' : +/* MIGRATE */ + actionstr ="trying to migrate" ; + action =RG_MIGRATE ; + svcname = optarg; +break ;case 's' :/* stop */ actionstr ="stopping" ;
@@ -237,7 +246,6 @@break ;case 'm' :/* member ... */ case 'n' :/* node .. same thing */ -strncpy (nodename,optarg,sizeof (nodename)); node_specified =1 ;break ;
@@ -277,15 +285,14 @@ me =get_my_nodeid (ch);if (node_specified) { - msgtarget =memb_name_to_id (membership, nodename); -if (msgtarget ==0 ) { + svctarget =memb_name_to_id (membership, nodename); +if (svctarget ==0 ) {fprintf (stderr,"Member %s not in membership list\n" , nodename);return 1 ; } - svctarget = msgtarget; }else { - msgtarget = me; + svctarget = me;/* clu_local_nodename(RG_SERVICE_GROUP, nodename, sizeof(nodename));
@@ -295,7 +302,7 @@strcpy (nodename,"me" );build_message (&msg, action, svcname, svctarget); -if (action !=RG_RELOCATE ) { +if (action !=RG_RELOCATE && action !=RG_MIGRATE ) {printf ("Member %s %s %s" , nodename, actionstr, svcname);printf ("..." );fflush (stdout);
@@ -330,7 +337,7 @@/* Decode */ swab_SmMessageSt (&msg);switch (msg.sm_data.d_ret) { -case SUCCESS : +case RG_ESUCCESS :printf ("success\n" );break ;case RG_EFAIL :