Message ID | 1625678434-240960-4-git-send-email-steven.sistare@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Live Update | expand |
Hi On Wed, Jul 7, 2021 at 9:28 PM Steve Sistare <steven.sistare@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.kanda@oracle.com> > Signed-off-by: Steve Sistare <steven.sistare@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.kanda@oracle.com> > S: Maintained > F: include/migration/cpr.h > F: migration/cpr.c > +F: qapi/cpr.json > > Record/replay > M: Pavel Dovgalyuk <pavel.dovgaluk@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 > > >
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.sistare@oracle.com <mailto:steven.sistare@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.kanda@oracle.com <mailto:mark.kanda@oracle.com>> > Signed-off-by: Steve Sistare <steven.sistare@oracle.com <mailto:steven.sistare@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.kanda@oracle.com <mailto:mark.kanda@oracle.com>> > S: Maintained > F: include/migration/cpr.h > F: migration/cpr.c > +F: qapi/cpr.json > > Record/replay > M: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru <mailto:pavel.dovgaluk@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
On Wed, Jul 07, 2021 at 10:20:12AM -0700, Steve Sistare 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' } } Does this also allow the magic "/dev/fdset/NNN" syntax for opening an fd already passed in previously? /me goes back to patch 2 to check Yes, it looks like it should. > > cprinfo returns a list of supported modes. Syntax: > { 'struct': 'CprInfo', 'data': { 'modes': [ 'CprMode' ] } } > { 'command': 'cprinfo', 'returns': 'CprInfo' } As pointed out elsewhere, relying on introspection seems nicer than adding this command. > > Signed-off-by: Mark Kanda <mark.kanda@oracle.com> > Signed-off-by: Steve Sistare <steven.sistare@oracle.com> > --- > +++ 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 Might be worth expanding what this acronym stands for here. > +## > + > +{ 'include': 'common.json' } > + > +## > +# @CprMode: > +# > +# @reboot: checkpoint can be cprload'ed after a host kexec reboot. > +# > +# Since: 6.1 As this missed 6.1, you'll need to (eventually) rebase the series to mention 6.2 everywhere.
On 8/4/2021 11:48 AM, Eric Blake wrote: > On Wed, Jul 07, 2021 at 10:20:12AM -0700, Steve Sistare 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' } } > > Does this also allow the magic "/dev/fdset/NNN" syntax for opening an > fd already passed in previously? > /me goes back to patch 2 to check > Yes, it looks like it should. > >> >> cprinfo returns a list of supported modes. Syntax: >> { 'struct': 'CprInfo', 'data': { 'modes': [ 'CprMode' ] } } >> { 'command': 'cprinfo', 'returns': 'CprInfo' } > > As pointed out elsewhere, relying on introspection seems nicer than > adding this command. > >> >> Signed-off-by: Mark Kanda <mark.kanda@oracle.com> >> Signed-off-by: Steve Sistare <steven.sistare@oracle.com> >> --- > >> +++ 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 > > Might be worth expanding what this acronym stands for here.> >> +## >> + >> +{ 'include': 'common.json' } >> + >> +## >> +# @CprMode: >> +# >> +# @reboot: checkpoint can be cprload'ed after a host kexec reboot. >> +# >> +# Since: 6.1 > > As this missed 6.1, you'll need to (eventually) rebase the series to > mention 6.2 everywhere. Will do for both. (Marc-Andre also asked). And I'll fix the indentation problem in patch 2. - Steve
diff --git a/MAINTAINERS b/MAINTAINERS index c3573aa..c48dd37 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2864,6 +2864,7 @@ M: Mark Kanda <mark.kanda@oracle.com> S: Maintained F: include/migration/cpr.h F: migration/cpr.c +F: qapi/cpr.json Record/replay M: Pavel Dovgalyuk <pavel.dovgaluk@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 +## + +{ '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. +# +# @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' }