On 02/25/2015 03:04 PM, zhanghailiang wrote:
> On 2015/2/17 7:47, Eric Blake wrote:
>> On 02/11/2015 08:17 PM, zhanghailiang wrote:
>>> We leave users to use whatever heartbeat solution they want, if the
>>> heartbeat
>>> is lost, or other errors they detect, they can use command
>>> 'colo_lost_heartbeat' to tell COLO to do failover, COLO will do operations
>>> accordingly.
>>>
>>> For example,
>>> If send the command to PVM, Primary will exit COLO mode, and takeover,
>>> if to Secondary, Secondary will do failover work and at last takeover
>>> server.
>>>
>>> Signed-off-by: zhanghailiang <[email protected]>
>>> Signed-off-by: Li Zhijian <[email protected]>
>>> Signed-off-by: Lai Jiangshan <[email protected]>
>>> Signed-off-by: Yang Hongyang <[email protected]>
>>> ---
>>> hmp-commands.hx | 15 ++++++++++++++
>>> hmp.c | 7 +++++++
>>> hmp.h | 1 +
>>> include/migration/migration-colo.h | 1 +
>>> include/migration/migration-failover.h | 20 ++++++++++++++++++
>>> migration/Makefile.objs | 2 +-
>>> migration/colo-failover.c | 38
>>> ++++++++++++++++++++++++++++++++++
>>> migration/colo.c | 1 +
>>> qapi-schema.json | 9 ++++++++
>>> qmp-commands.hx | 19 +++++++++++++++++
>>> stubs/migration-colo.c | 8 +++++++
>>> 11 files changed, 120 insertions(+), 1 deletion(-)
>>> create mode 100644 include/migration/migration-failover.h
>>> create mode 100644 migration/colo-failover.c
>>>
>>> diff --git a/hmp-commands.hx b/hmp-commands.hx
>>
>>> +++ b/qapi-schema.json
>>> @@ -543,6 +543,15 @@
>>> { 'command': 'query-migrate-capabilities', 'returns':
>>> ['MigrationCapabilityStatus']}
>>>
>>> ##
>>> +# @colo-lost-heartbeat
>>> +#
>>> +# Tell COLO that heartbeat is lost
>>> +#
>>> +# Since: 2.3
>>> +##
>>> +{ 'command': 'colo-lost-heartbeat' }
>>
>> Okay...
>>
>>> +
>>> +##
>>> # @MouseInfo:
>>> #
>>> # Information about a mouse device.
>>> diff --git a/qmp-commands.hx b/qmp-commands.hx
>>> index a85d847..1b4a5ca 100644
>>> --- a/qmp-commands.hx
>>> +++ b/qmp-commands.hx
>>> @@ -753,6 +753,25 @@ Example:
>>> EQMP
>>>
>>> {
>>> + .name = "colo_lost_heartbeat",
>>
>> ...but documented incorrectly (this should use '-' to match the command
>> name in the .json file, not '_')
>>
>
> Er, yes, you are right, here it should be 'colo-lost-heartbeat' in
> qmp-commands.hx,
> but 'colo_lost_heartbeat' in hmp-commands.hx, it is a little confused for me,
> why it should be like this?
>
> i will fix it.
>
>>> + .args_type = "",
>>> + .mhandler.cmd_new = qmp_marshal_input_colo_lost_heartbeat,
>>> + },
>>> +
>>> +SQMP
>>> +colo_lost_heartbeat
same here
>>> +--------------------
>>> +
>>> +Tell COLO that heartbeat is lost, a failover or takeover is needed.
>>> +
>>> +Example:
>>> +
>>> +-> { "execute": "colo_lost_heartbeat" }
>>> +<- { "return": {} }
>>
>> This example won't work unless you fix the spelling.
>>
>
> Should here also be changed to 'colo-lost-heartbeat' ?
Yes.
Thanks
Wen Congyang
>
> Thanks,
> zhanghailiang
>
>
>
> .
>