@@ -35,9 +35,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)
{
@@ -161,6 +163,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()) {
@@ -5,7 +5,8 @@ util-obj-y += opts-visitor.o qapi-clone-visitor.o
util-obj-y += qmp-event.o
util-obj-y += qapi-util.o
-QAPI_COMMON_MODULES = audio authz block-core block char common control crypto
+QAPI_COMMON_MODULES = audio authz block-core block char
+QAPI_COMMON_MODULES += common cpr control crypto
QAPI_COMMON_MODULES += dump error introspect job machine migration misc
QAPI_COMMON_MODULES += net pragma qdev qom rdma rocker run-state sockets tpm
QAPI_COMMON_MODULES += trace transaction ui
new file mode 100644
@@ -0,0 +1,68 @@
+# -*- 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.
+#
+# @restart: checkpoint can be cprload'ed after restarting qemu.
+#
+# Since 5.3
+##
+{ 'enum': 'CprMode', 'data': [ 'reboot', 'restart' ] }
+
+
+##
+# @CprInfo:
+#
+# @modes: @CprMode list
+#
+# Since 5.3
+##
+{ 'struct': 'CprInfo', 'data': { 'modes': [ 'CprMode' ] } }
+
+##
+# @cprinfo:
+#
+# Returns: @CprInfo
+#
+# Since 5.3
+##
+{ '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 5.3
+##
+{ '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 5.3
+##
+{ 'command': 'cprload', 'data': { 'file': 'str' } }
+
@@ -74,6 +74,7 @@
{ 'include': 'ui.json' }
{ 'include': 'authz.json' }
{ 'include': 'migration.json' }
+{ 'include': 'cpr.json' }
{ 'include': 'transaction.json' }
{ 'include': 'trace.json' }
{ 'include': 'control.json' }