Will do for all. Good idea on schema introspection. - steve
On 7/8/2021 9:27 AM, Marc-André Lureau wrote:
> Hi
>
> On Wed, Jul 7, 2021 at 9:28 PM Steve Sistare <steven.sist...@oracle.com
> <mailto:steven.sist...@oracle.com>> wrote:
>
> cprsave calls cprsave(). Syntax:
> { 'enum': 'CprMode', 'data': [ 'reboot' ] }
> { 'command': 'cprsave', 'data': { 'file': 'str', 'mode': 'CprMode' } }
>
> cprload calls cprload(). Syntax:
> { 'command': 'cprload', 'data': { 'file': 'str' } }
>
> cprinfo returns a list of supported modes. Syntax:
> { 'struct': 'CprInfo', 'data': { 'modes': [ 'CprMode' ] } }
> { 'command': 'cprinfo', 'returns': 'CprInfo' }
>
>
> It may not be necessary, we may instead rely on query-qmp-schema
> introspection.
>
>
> Signed-off-by: Mark Kanda <mark.ka...@oracle.com
> <mailto:mark.ka...@oracle.com>>
> Signed-off-by: Steve Sistare <steven.sist...@oracle.com
> <mailto:steven.sist...@oracle.com>>
> ---
> MAINTAINERS | 1 +
> monitor/qmp-cmds.c | 31 +++++++++++++++++++++
> qapi/cpr.json | 74
> +++++++++++++++++++++++++++++++++++++++++++++++++++
> qapi/meson.build | 1 +
> qapi/qapi-schema.json | 1 +
> 5 files changed, 108 insertions(+)
> create mode 100644 qapi/cpr.json
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c3573aa..c48dd37 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2864,6 +2864,7 @@ M: Mark Kanda <mark.ka...@oracle.com
> <mailto:mark.ka...@oracle.com>>
> S: Maintained
> F: include/migration/cpr.h
> F: migration/cpr.c
> +F: qapi/cpr.json
>
> Record/replay
> M: Pavel Dovgalyuk <pavel.dovga...@ispras.ru
> <mailto:pavel.dovga...@ispras.ru>>
> diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
> index f7d64a6..1128604 100644
> --- a/monitor/qmp-cmds.c
> +++ b/monitor/qmp-cmds.c
> @@ -37,9 +37,11 @@
> #include "qapi/qapi-commands-machine.h"
> #include "qapi/qapi-commands-misc.h"
> #include "qapi/qapi-commands-ui.h"
> +#include "qapi/qapi-commands-cpr.h"
> #include "qapi/qmp/qerror.h"
> #include "hw/mem/memory-device.h"
> #include "hw/acpi/acpi_dev_interface.h"
> +#include "migration/cpr.h"
>
> NameInfo *qmp_query_name(Error **errp)
> {
> @@ -153,6 +155,35 @@ void qmp_cont(Error **errp)
> }
> }
>
> +CprInfo *qmp_cprinfo(Error **errp)
> +{
> + CprInfo *cprinfo;
> + CprModeList *mode, *mode_list = NULL;
> + CprMode i;
> +
> + cprinfo = g_malloc0(sizeof(*cprinfo));
> +
> + for (i = 0; i < CPR_MODE__MAX; i++) {
> + mode = g_malloc0(sizeof(*mode));
> + mode->value = i;
> + mode->next = mode_list;
> + mode_list = mode;
> + }
> +
> + cprinfo->modes = mode_list;
> + return cprinfo;
> +}
> +
> +void qmp_cprsave(const char *file, CprMode mode, Error **errp)
> +{
> + cprsave(file, mode, errp);
> +}
> +
> +void qmp_cprload(const char *file, Error **errp)
> +{
> + cprload(file, errp);
> +}
> +
> void qmp_system_wakeup(Error **errp)
> {
> if (!qemu_wakeup_suspend_enabled()) {
> diff --git a/qapi/cpr.json b/qapi/cpr.json
> new file mode 100644
> index 0000000..b6fdc89
> --- /dev/null
> +++ b/qapi/cpr.json
> @@ -0,0 +1,74 @@
> +# -*- Mode: Python -*-
> +#
> +# Copyright (c) 2021 Oracle and/or its affiliates.
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2.
> +# See the COPYING file in the top-level directory.
> +
> +##
> +# = CPR
>
>
> Please spell it out in the doc at least (it's not obvious, I had to search
> for the meaning in list archives ;).
>
> +##
> +
> +{ 'include': 'common.json' }
> +
> +##
> +# @CprMode:
> +#
> +# @reboot: checkpoint can be cprload'ed after a host kexec reboot.
> +#
> +# Since: 6.1
> +##
> +{ 'enum': 'CprMode',
> + 'data': [ 'reboot' ] }
> +
> +
> +##
> +# @CprInfo:
> +#
> +# @modes: @CprMode list
> +#
> +# Since: 6.1
> +##
> +{ 'struct': 'CprInfo',
> + 'data': { 'modes': [ 'CprMode' ] } }
> +
> +##
> +# @cprinfo:
> +#
> +# Returns the modes supported by @cprsave.
> +#
> +# Returns: @CprInfo
> +#
> +# Since: 6.1
> +#
> +##
> +{ 'command': 'cprinfo',
> + 'returns': 'CprInfo' }
> +
> +##
> +# @cprsave:
> +#
> +# Create a checkpoint of the virtual machine device state in @file.
> +# Guest RAM and guest block device blocks are not saved.
> +#
>
>
> It would be worth highlighting the differences with snapshot-save/load.
>
> I guess it would make sense to consider this as an extension/variant to those
> commands.
>
>
> +# @file: name of checkpoint file
> +# @mode: @CprMode mode
> +#
> +# Since: 6.1
> +##
> +{ 'command': 'cprsave',
> + 'data': { 'file': 'str',
> + 'mode': 'CprMode' } }
> +
> +##
> +# @cprload:
> +#
> +# Start virtual machine from checkpoint file that was created earlier
> using
> +# the cprsave command.
> +#
> +# @file: name of checkpoint file
> +#
> +# Since: 6.1
> +##
> +{ 'command': 'cprload',
> + 'data': { 'file': 'str' } }
> diff --git a/qapi/meson.build b/qapi/meson.build
> index 376f4ce..7e7c48a 100644
> --- a/qapi/meson.build
> +++ b/qapi/meson.build
> @@ -26,6 +26,7 @@ qapi_all_modules = [
> 'common',
> 'compat',
> 'control',
> + 'cpr',
> 'crypto',
> 'dump',
> 'error',
> diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
> index 4912b97..001d790 100644
> --- a/qapi/qapi-schema.json
> +++ b/qapi/qapi-schema.json
> @@ -77,6 +77,7 @@
> { 'include': 'ui.json' }
> { 'include': 'authz.json' }
> { 'include': 'migration.json' }
> +{ 'include': 'cpr.json' }
> { 'include': 'transaction.json' }
> { 'include': 'trace.json' }
> { 'include': 'compat.json' }
> --
> 1.8.3.1
>
>
>
>
> --
> Marc-André Lureau