[Linux-ha-dev] Re: [Linux-ha-cvs] Linux-HA CVS: lrm by zhenh from
Andrew Beekhof
lists at beekhof.net
Fri Oct 22 02:53:23 MDT 2004
On Oct 22, 2004, at 4:07 AM, Huang Zhen wrote:
> Andrew Beekhof wrote:
>> I dont really understand the code, but the description tells me
>> something is wrong.
>> Start, stop, and status are all operations. So stopping an RA is not
>> the same thing as canceling an operation. So just like the start
>
> Right. Please notice that the description is "when we stop an
> operation" instead of "when we execute an stop operation".
ok, so we are talking about the same thing. the overloaded use of
"stop" threw me.
so back to the question i asked sunjd... can you think of any reason
why i wouldn't get a callback after: perform_op(rsc, "stop") ?
>
>> operation, if the stop fails, we should get a LRM_OP_ERROR and if it
>> is successful LRM_OP_DONE.
>
> the LRM_OP_DONE is returned in op_status field when the execl() for
> the operation launched successfully and the child process exit.
>
> The rc field is based on the exit code from the child process.
> The rc field indicates whether the RA(like IPaddr) works well.
>
>> The status command is a little different in that it might be a
>> recurring action. In this case we must cancel it using the stop_op()
>> (perhaps this should be better renamed cancel_op()). If this command
>> fails, I would expect an LRM_OP_ERROR and if it completes
>> LRM_OP_CANCELLED.
> Rename the stop_op() to cancel_op() is a good idea. I will do it now.
>
> Now when we execute stop_op(), a callback with the stopped(cancelled)
> operation will be called with the op_status ==
> LRM_OP_LRM_OP_CANCELLED.
ok makes sense
>
> About return value of stop_op() itself, I could change it to this:
> if we find the operation to cancelled, return HA_OK,
> if not, return HA_FAILED.
i think that would be ok for cancel_op(...), but perform_op(...) had
the same sort of problems last time i looked. i think it should always
return a value from the UNIFORM_RET_EXECRA enum.
> Is it ok for you?
>
>> Please let me know if this does not make sense.
>> Andrew
>> On Oct 21, 2004, at 5:13 AM, linux-ha-cvs at lists.linux-ha.org wrote:
>>> linux-ha CVS committal
>>>
>>> Author : zhenh
>>> Host :
>>> Project : linux-ha
>>> Module : lrm
>>>
>>> Dir : linux-ha/lrm/lrmd
>>>
>>>
>>> Modified Files:
>>> lrmd.c
>>>
>>>
>>> Log Message:
>>> call callback function with op_status==LRM_OP_CANCELLED when we stop
>>> an operation
>>>
>>> ===================================================================
>>> RCS file: /home/cvs/linux-ha/linux-ha/lrm/lrmd/lrmd.c,v
>>> retrieving revision 1.45
>>> retrieving revision 1.46
>>> diff -u -3 -r1.45 -r1.46
>>> --- lrmd.c 10 Oct 2004 02:42:03 -0000 1.45
>>> +++ lrmd.c 21 Oct 2004 03:13:07 -0000 1.46
>>> @@ -1,4 +1,4 @@
>>> -/* $Id: lrmd.c,v 1.45 2004/10/10 02:42:03 zhenh Exp $ */
>>> +/* $Id: lrmd.c,v 1.46 2004/10/21 03:13:07 zhenh Exp $ */
>>> /*
>>> * Local Resource Manager Daemon
>>> *
>>> @@ -1176,8 +1176,7 @@
>>> }
>>> /* free the last_op */
>>> if ( NULL!=rsc->last_op) {
>>> - ha_msg_del(rsc->last_op->msg);
>>> - g_free(rsc->last_op);
>>> + free_op(rsc->last_op);
>>> }
>>> /* free the memeroy of rsc */
>>> @@ -1280,6 +1279,14 @@
>>> rsc->op_list = g_list_remove(rsc->op_list, op);
>>> flush_op(op);
>>> }
>>> + node = g_list_first(rsc->repeat_op_list);
>>> + while (NULL != node ) {
>>> + op = (lrmd_op_t*)node->data;
>>> + node = g_list_next(node);
>>> + rsc->repeat_op_list =
>>> + g_list_remove(rsc->repeat_op_list, op);
>>> + flush_op(op);
>>> + }
>>> }
>>> else
>>> if (0 == strncmp(type, STOPOP, strlen(STOPOP))) {
>>> @@ -1292,7 +1299,7 @@
>>> node = g_list_next(node);
>>> if ( op->call_id == call_id) {
>>> rsc->op_list = g_list_remove(rsc->op_list, op);
>>> - free_op(op);
>>> + flush_op(op);
>>> break;
>>> }
>>> }
>>> @@ -1303,7 +1310,7 @@
>>> if ( op->call_id == call_id) {
>>> rsc->repeat_op_list =
>>> g_list_remove(rsc->repeat_op_list, op);
>>> - free_op(op);
>>> + flush_op(op);
>>> break;
>>> }
>>> }
>>> @@ -1454,8 +1461,7 @@
>>> g_source_remove(op->timeout_tag);
>>> }
>>> /* delete the op */
>>> - ha_msg_del(op->msg);
>>> - g_free(op);
>>> + free_op(op);
>>>
>>> lrmd_log(LOG_DEBUG,
>>> "on_op_done: the resource of this op does not exists");
>>> @@ -1529,8 +1535,7 @@
>>> }
>>> /* release the old last_op */
>>> if ( NULL!=op->rsc->last_op) {
>>> - ha_msg_del(op->rsc->last_op->msg);
>>> - g_free(op->rsc->last_op);
>>> + free_op(op->rsc->last_op);
>>> }
>>> /* remove the op from op_list and copy to last_op */
>>> op->rsc->op_list = g_list_remove(op->rsc->op_list,op);
>>> @@ -1549,15 +1554,14 @@
>>> if( op->timeout_tag > 0 ) {
>>> g_source_remove(op->timeout_tag);
>>> }
>>> -
>>> - if ( 0!=op->interval && NULL != g_list_find(client_list,
>>> op->client)) {
>>> + if ( 0!=op->interval && NULL != g_list_find(client_list,
>>> op->client)
>>> + && LRM_OP_CANCELLED != op_status) {
>>> op->repeat_timeout_tag = g_timeout_add(op->interval,
>>> on_repeat_op_done, op);
>>> op->rsc->repeat_op_list = g_list_append
>>> (op->rsc->repeat_op_list, op);
>>> }
>>> else {
>>> - ha_msg_del(op->msg);
>>> - g_free(op);
>>> + free_op(op);
>>> }
>>>
>>> lrmd_log(LOG_DEBUG, "on_op_done: end.");
>>> @@ -1573,10 +1577,12 @@
>>> return HA_FAIL;
>>> }
>>>
>>> - if (HA_OK !=
>>> ha_msg_add_int(op->msg,F_LRM_OPSTATUS,LRM_OP_CANCELLED)){
>>> + if (HA_OK !=
>>> ha_msg_mod_int(op->msg,F_LRM_OPSTATUS,(int)LRM_OP_CANCELLED)){
>>> lrmd_log(LOG_ERR,"flush_op: can not add op status");
>>> return HA_FAIL;
>>> }
>>> +
>>> + if (-1 != op->exec_pid ) {
>>> kill(op->exec_pid, 9);
>>> }
>>> @@ -2034,6 +2040,9 @@
>>>
>>> /*
>>> * $Log: lrmd.c,v $
>>> + * Revision 1.46 2004/10/21 03:13:07 zhenh
>>> + * call callback function with op_status==LRM_OP_CANCELLED when we
>>> stop an operation
>>> + *
>>> * Revision 1.45 2004/10/10 02:42:03 zhenh
>>> * remove the call to enable log deamon
>>> *
>>>
>>>
>>> _______________________________________________
>>> Linux-ha-cvs mailing list
>>> Linux-ha-cvs at lists.linux-ha.org
>>> http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
>>>
>> --
>> Andrew Beekhof
>> "If it weren't for my horse, I wouldn't have spent that year in
>> college" - Unknown courtesy of Lewis Black
>> _______________________________________________________
>> Linux-HA-Dev: Linux-HA-Dev at lists.linux-ha.org
>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>> Home Page: http://linux-ha.org/
>
>
> --
>
> Best Regards,
> Huang Zhen
> LTC and pLinux Testing
> IBM China Software Development Lab, Beijing
> Telno: (8610)82782244-2845
>
>
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev at lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
--
Andrew Beekhof
"If it weren't for my horse, I wouldn't have spent that year in
college" - Unknown courtesy of Lewis Black
More information about the Linux-HA-Dev
mailing list