[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V3 08/22] cpr: QMP interfaces
From: |
Steve Sistare |
Subject: |
[PATCH V3 08/22] cpr: QMP interfaces |
Date: |
Fri, 7 May 2021 05:25:06 -0700 |
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/cpr.json | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++
qapi/meson.build | 1 +
qapi/qapi-schema.json | 1 +
4 files changed, 109 insertions(+)
create mode 100644 qapi/cpr.json
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..2d80cca
--- /dev/null
+++ b/qapi/cpr.json
@@ -0,0 +1,76 @@
+# -*- 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: 6.0
+##
+{ 'enum': 'CprMode',
+ 'data': [ 'reboot', 'restart' ] }
+
+
+##
+# @CprInfo:
+#
+# @modes: @CprMode list
+#
+# Since: 6.0
+##
+{ 'struct': 'CprInfo',
+ 'data': { 'modes': [ 'CprMode' ] } }
+
+##
+# @cprinfo:
+#
+# Returns the modes supported by @cprsave.
+#
+# Returns: @CprInfo
+#
+# Since: 6.0
+#
+##
+{ '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.0
+##
+{ '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.0
+##
+{ '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
- Re: [PATCH V3 11/22] vfio-pci: refactor for cpr, (continued)
- [PATCH V3 14/22] vhost: reset vhost devices upon cprsave, Steve Sistare, 2021/05/07
- [PATCH V3 10/22] pci: export functions for cpr, Steve Sistare, 2021/05/07
- [PATCH V3 15/22] hostmem-memfd: cpr support, Steve Sistare, 2021/05/07
- [PATCH V3 12/22] vfio-pci: cpr part 1, Steve Sistare, 2021/05/07
- [PATCH V3 13/22] vfio-pci: cpr part 2, Steve Sistare, 2021/05/07
- [PATCH V3 08/22] cpr: QMP interfaces,
Steve Sistare <=
- [PATCH V3 17/22] chardev: cpr for simple devices, Steve Sistare, 2021/05/07
- [PATCH V3 19/22] chardev: cpr for sockets, Steve Sistare, 2021/05/07
- [PATCH V3 20/22] cpr: only-cpr-capable option, Steve Sistare, 2021/05/07
- [PATCH V3 18/22] chardev: cpr for pty, Steve Sistare, 2021/05/07
- [PATCH V3 16/22] chardev: cpr framework, Steve Sistare, 2021/05/07
- [PATCH V3 22/22] simplify savevm, Steve Sistare, 2021/05/07
- [PATCH V3 21/22] cpr: maintainers, Steve Sistare, 2021/05/07
- [PATCH V3 09/22] cpr: HMP interfaces, Steve Sistare, 2021/05/07