[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v4 PATCH 46/49] multi-process/mig: Restore the VMSD in remote proce
From: |
Jagannathan Raman |
Subject: |
[RFC v4 PATCH 46/49] multi-process/mig: Restore the VMSD in remote process |
Date: |
Thu, 24 Oct 2019 05:09:27 -0400 |
From: Elena Ufimtseva <address@hidden>
The remote process accepts the VMSD from Proxy object and
restores it
Signed-off-by: Elena Ufimtseva <address@hidden>
Signed-off-by: John G Johnson <address@hidden>
Signed-off-by: Jagannathan Raman <address@hidden>
---
New patch in v4
migration/savevm.c | 36 ++++++++++++++++++++++++++++++++++++
migration/savevm.h | 1 +
remote/remote-main.c | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 71 insertions(+)
diff --git a/migration/savevm.c b/migration/savevm.c
index 0c84142..d730cd1 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2930,3 +2930,39 @@ int qemu_remote_savevm(QEMUFile *f)
return 0;
}
+
+int qemu_remote_loadvm(QEMUFile *f)
+{
+ uint8_t section_type;
+ int ret = 0;
+
+ qemu_mutex_lock_iothread();
+
+ while (true) {
+ section_type = qemu_get_byte(f);
+
+ if (qemu_file_get_error(f)) {
+ ret = qemu_file_get_error(f);
+ break;
+ }
+
+ switch (section_type) {
+ case QEMU_VM_SECTION_FULL:
+ ret = qemu_loadvm_section_start_full(f, NULL);
+ if (ret < 0) {
+ break;
+ }
+ break;
+ case QEMU_VM_EOF:
+ goto out;
+ default:
+ ret = -EINVAL;
+ goto out;
+ }
+ }
+
+out:
+ qemu_mutex_unlock_iothread();
+
+ return ret;
+}
diff --git a/migration/savevm.h b/migration/savevm.h
index a6582ac..415b72c 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -65,5 +65,6 @@ int qemu_loadvm_state_main(QEMUFile *f,
MigrationIncomingState *mis);
int qemu_load_device_state(QEMUFile *f);
int qemu_remote_savevm(QEMUFile *f);
+int qemu_remote_loadvm(QEMUFile *f);
#endif
diff --git a/remote/remote-main.c b/remote/remote-main.c
index 2de5ddf..600c894 100644
--- a/remote/remote-main.c
+++ b/remote/remote-main.c
@@ -81,6 +81,7 @@
#include "chardev/char.h"
#include "sysemu/reset.h"
#include "vl.h"
+#include "migration/misc.h"
static MPQemuLinkState *mpqemu_link;
@@ -403,6 +404,30 @@ static void process_start_mig_out(MPQemuMsg *msg)
qemu_fclose(f);
}
+static int process_start_mig_in(MPQemuMsg *msg)
+{
+ Error *err = NULL;
+ QIOChannel *ioc;
+ QEMUFile *f;
+ int rc = -EINVAL;
+
+ ioc = qio_channel_new_fd(msg->fds[0], &err);
+ if (err) {
+ error_report_err(err);
+ return rc;
+ }
+
+ qio_channel_set_name(QIO_CHANNEL(ioc), "remote-migration-channel");
+
+ f = qemu_fopen_channel_input(ioc);
+
+ rc = qemu_remote_loadvm(f);
+
+ qemu_fclose(f);
+
+ return rc;
+}
+
static void process_msg(GIOCondition cond, MPQemuChannel *chan)
{
MPQemuMsg *msg = NULL;
@@ -498,6 +523,13 @@ static void process_msg(GIOCondition cond, MPQemuChannel
*chan)
case START_MIG_OUT:
process_start_mig_out(msg);
break;
+ case START_MIG_IN:
+ if (process_start_mig_in(msg))
+ {
+ error_setg(&err, "Incoming migration failed.");
+ goto finalize_loop;
+ }
+ break;
case RUNSTATE_SET:
remote_runstate_set(msg->data1.runstate.state);
break;
@@ -569,6 +601,8 @@ int main(int argc, char *argv[])
}
mpqemu_init_channel(mpqemu_link, &mpqemu_link->mmio, fd);
+ migration_object_init();
+
parse_cmdline(argc - 3, argv + 3, NULL);
mpqemu_link_set_callback(mpqemu_link, process_msg);
--
1.8.3.1
- [RFC v4 PATCH 08/49] multi-process: add functions to synchronize proxy and remote endpoints, (continued)
- [RFC v4 PATCH 08/49] multi-process: add functions to synchronize proxy and remote endpoints, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 07/49] multi-process: define mpqemu-link object, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 49/49] multi-process: add configure and usage information, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 48/49] multi-process: add the concept description to docs/devel/qemu-multiprocess, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 12/49] multi-process: remote process initialization, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 17/49] multi-process: Synchronize remote memory, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 25/49] multi-process: Introduce build flags to separate remote process code, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 29/49] multi-process: add parse_cmdline in remote process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 33/49] multi-process: perform device reset in the remote process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 43/49] multi-process/mig: Load VMSD in the proxy object, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 46/49] multi-process/mig: Restore the VMSD in remote process,
Jagannathan Raman <=
- Re: [RFC v4 PATCH 00/49] Initial support of multi-process qemu, no-reply, 2019/10/24
- Re: [RFC v4 PATCH 00/49] Initial support of multi-process qemu, no-reply, 2019/10/24
- Re: [RFC v4 PATCH 00/49] Initial support of multi-process qemu, no-reply, 2019/10/24