[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V2 08/22] cpr: QMP interfaces
From: |
Steve Sistare |
Subject: |
[PATCH V2 08/22] cpr: QMP interfaces |
Date: |
Tue, 5 Jan 2021 07:41:56 -0800 |
cprsave calls cprsave(). Syntax:
{ 'enum': 'CprMode', 'data': [ 'reboot', 'restart' ] }
{ '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' }
Signed-off-by: Mark Kanda <mark.kanda@oracle.com>
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
monitor/qmp-cmds.c | 31 +++++++++++++++++++++++
qapi/Makefile.objs | 3 ++-
qapi/cpr.json | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++
qapi/qapi-schema.json | 1 +
4 files changed, 102 insertions(+), 1 deletion(-)
create mode 100644 qapi/cpr.json
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 864cbfa..3778b04 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -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()) {
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index 4673ab7..099b325 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -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
diff --git a/qapi/cpr.json b/qapi/cpr.json
new file mode 100644
index 0000000..588749f
--- /dev/null
+++ b/qapi/cpr.json
@@ -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' } }
+
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index f03ff91..0d47ab6 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -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' }
--
1.8.3.1
- [PATCH V2 00/22] Live Update, Steve Sistare, 2021/01/05
- [PATCH V2 03/22] oslib: qemu_clr_cloexec, Steve Sistare, 2021/01/05
- [PATCH V2 06/22] vl: add helper to request re-exec, Steve Sistare, 2021/01/05
- [PATCH V2 04/22] util: env var helpers, Steve Sistare, 2021/01/05
- [PATCH V2 08/22] cpr: QMP interfaces,
Steve Sistare <=
- [PATCH V2 09/22] cpr: HMP interfaces, Steve Sistare, 2021/01/05
- [PATCH V2 10/22] pci: export functions for cpr, Steve Sistare, 2021/01/05
- [PATCH V2 07/22] cpr, Steve Sistare, 2021/01/05
- [PATCH V2 05/22] vl: memfd-alloc option, Steve Sistare, 2021/01/05
[PATCH V2 12/22] vfio-pci: cpr, Steve Sistare, 2021/01/05
[PATCH V2 16/22] chardev: cpr for pty, Steve Sistare, 2021/01/05