[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V8 21/39] cpr: restart HMP interfaces
From: |
Steve Sistare |
Subject: |
[PATCH V8 21/39] cpr: restart HMP interfaces |
Date: |
Wed, 15 Jun 2022 07:52:08 -0700 |
cpr-save <filename> <mode>
mode may be "restart"
cpr-exec <command>
Call qmp_cpr_exec().
Arguments:
command : command line to execute, with space-separated arguments
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
hmp-commands.hx | 29 ++++++++++++++++++++++++++---
include/monitor/hmp.h | 1 +
monitor/hmp-cmds.c | 11 +++++++++++
3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index d621968..da5dd60 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -357,7 +357,7 @@ ERST
{
.name = "cpr-save",
.args_type = "filename:s,mode:s",
- .params = "filename 'reboot'",
+ .params = "filename 'reboot'|'restart'",
.help = "create a checkpoint of the VM in file",
.cmd = hmp_cpr_save,
},
@@ -377,13 +377,36 @@ SRST
reboot, else it will be saved to the file. To resume from the checkpoint,
issue the quit command, reboot the system, start qemu using the same
arguments plus -S, and issue the cpr-load command.
+
+ If *mode* is 'restart', the checkpoint remains valid after restarting
+ qemu using a subsequent cpr-exec. Guest RAM must be backed by a
+ memory-backend-file with share=on.
+ To resume from the checkpoint, issue the cpr-load command.
+ERST
+
+ {
+ .name = "cpr-exec",
+ .args_type = "command:S",
+ .params = "command",
+ .help = "Restart qemu by directly exec'ing command",
+ .cmd = hmp_cpr_exec,
+ },
+
+SRST
+``cpr-exec`` *command*
+ Restart qemu by directly exec'ing *command*, replacing the qemu process.
+ The PID remains the same. Must be called after cpr-save restart.
+
+ *command*[0] should be the path of a new qemu binary, or a prefix command
that
+ in turn exec's the new qemu binary. The arguments must match those used
+ to initially start qemu, plus the -S option so new qemu starts in a paused
+ state.
ERST
{
.name = "cpr-load",
.args_type = "filename:s,mode:s",
- .params = "filename 'reboot'",
-
+ .params = "filename 'reboot'|'restart'",
.help = "load VM checkpoint from file",
.cmd = hmp_cpr_load,
},
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index b44588e..ec4fa44 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -60,6 +60,7 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict);
void hmp_savevm(Monitor *mon, const QDict *qdict);
void hmp_delvm(Monitor *mon, const QDict *qdict);
void hmp_cpr_save(Monitor *mon, const QDict *qdict);
+void hmp_cpr_exec(Monitor *mon, const QDict *qdict);
void hmp_cpr_load(Monitor *mon, const QDict *qdict);
void hmp_migrate_cancel(Monitor *mon, const QDict *qdict);
void hmp_migrate_continue(Monitor *mon, const QDict *qdict);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 9f58b1f..b866c7f 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1111,6 +1111,17 @@ void hmp_cpr_save(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, err);
}
+void hmp_cpr_exec(Monitor *mon, const QDict *qdict)
+{
+ Error *err = NULL;
+ const char *command = qdict_get_try_str(qdict, "command");
+ strList *args = strList_from_string(command, ' ');
+
+ qmp_cpr_exec(args, &err);
+ qapi_free_strList(args);
+ hmp_handle_error(mon, err);
+}
+
void hmp_cpr_load(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
--
1.8.3.1
- [PATCH V8 20/39] cpr: restart mode, (continued)
- [PATCH V8 20/39] cpr: restart mode, Steve Sistare, 2022/06/15
- [PATCH V8 29/39] vfio-pci: cpr part 3 (intx), Steve Sistare, 2022/06/15
- [PATCH V8 17/39] qapi: strList unit tests, Steve Sistare, 2022/06/15
- [PATCH V8 14/39] qapi: strList_from_string, Steve Sistare, 2022/06/15
- [PATCH V8 18/39] vl: helper to request re-exec, Steve Sistare, 2022/06/15
- [PATCH V8 22/39] cpr: ram block blockers, Steve Sistare, 2022/06/15
- [PATCH V8 23/39] hostmem-memfd: cpr for memory-backend-memfd, Steve Sistare, 2022/06/15
- [PATCH V8 19/39] cpr: preserve extra state, Steve Sistare, 2022/06/15
- [PATCH V8 21/39] cpr: restart HMP interfaces,
Steve Sistare <=
- [PATCH V8 24/39] pci: export export msix_is_pending, Steve Sistare, 2022/06/15
- [PATCH V8 31/39] vhost: reset vhost devices for cpr, Steve Sistare, 2022/06/15
- [PATCH V8 26/39] vfio-pci: refactor for cpr, Steve Sistare, 2022/06/15
- [PATCH V8 36/39] chardev: cpr for sockets, Steve Sistare, 2022/06/15
- [PATCH V8 28/39] vfio-pci: cpr part 2 (msi), Steve Sistare, 2022/06/15
- [PATCH V8 33/39] chardev: cpr framework, Steve Sistare, 2022/06/15
- [PATCH V8 35/39] chardev: cpr for pty, Steve Sistare, 2022/06/15
- [PATCH V8 32/39] loader: suppress rom_reset during cpr, Steve Sistare, 2022/06/15