[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 46/50] multi-process/mig: Restore the VMSD in remote process
From: |
Jagannathan Raman |
Subject: |
[PATCH v5 46/50] multi-process/mig: Restore the VMSD in remote process |
Date: |
Mon, 24 Feb 2020 15:55:37 -0500 |
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>
---
migration/savevm.c | 36 ++++++++++++++++++++++++++++++++++++
migration/savevm.h | 1 +
remote/remote-main.c | 33 +++++++++++++++++++++++++++++++++
3 files changed, 70 insertions(+)
diff --git a/migration/savevm.c b/migration/savevm.c
index 09af14d..e95ea4a 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2969,3 +2969,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 0491d3a..8741c66 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -66,5 +66,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 0260c7c..ab4ad0b 100644
--- a/remote/remote-main.c
+++ b/remote/remote-main.c
@@ -68,6 +68,7 @@
#include "chardev/char.h"
#include "sysemu/reset.h"
#include "vl.h"
+#include "migration/misc.h"
static MPQemuLinkState *mpqemu_link;
@@ -363,6 +364,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;
@@ -455,6 +480,12 @@ 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);
notify_proxy(msg->fds[0], 0);
@@ -532,6 +563,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
- [PATCH v5 34/50] multi-process/mon: choose HMP commands based on target, (continued)
- [PATCH v5 34/50] multi-process/mon: choose HMP commands based on target, Jagannathan Raman, 2020/02/24
- [PATCH v5 35/50] multi-process/mon: stub functions to enable QMP module for remote process, Jagannathan Raman, 2020/02/24
- [PATCH v5 30/50] multi-process: send heartbeat messages to remote, Jagannathan Raman, 2020/02/24
- [PATCH v5 31/50] multi-process: handle heartbeat messages in remote process, Jagannathan Raman, 2020/02/24
- [PATCH v5 38/50] multi-process/mon: Initialize QMP module for remote processes, Jagannathan Raman, 2020/02/24
- [PATCH v5 43/50] multi-process/mig: Load VMSD in the proxy object, Jagannathan Raman, 2020/02/24
- [PATCH v5 42/50] multi-process/mig: Send VMSD of remote to the Proxy object, Jagannathan Raman, 2020/02/24
- [PATCH v5 37/50] multi-process/mon: Refactor monitor/chardev functions out of vl.c, Jagannathan Raman, 2020/02/24
- [PATCH v5 36/50] multi-process/mon: enable QMP module support in the remote process, Jagannathan Raman, 2020/02/24
- [PATCH v5 45/50] multi-process/mig: Synchronize runstate of remote process, Jagannathan Raman, 2020/02/24
- [PATCH v5 46/50] multi-process/mig: Restore the VMSD in remote process,
Jagannathan Raman <=
- [PATCH v5 39/50] multi-process: prevent duplicate memory initialization in remote, Jagannathan Raman, 2020/02/24
- [PATCH v5 48/50] multi-process: Validate incoming commands from Proxy, Jagannathan Raman, 2020/02/24
- [PATCH v5 41/50] multi-process/mig: Enable VMSD save in the Proxy object, Jagannathan Raman, 2020/02/24
- [PATCH v5 50/50] multi-process: add configure and usage information, Jagannathan Raman, 2020/02/24
- [PATCH v5 40/50] multi-process/mig: build migration module in the remote process, Jagannathan Raman, 2020/02/24
- [PATCH v5 44/50] multi-process/mig: refactor runstate_check into common file, Jagannathan Raman, 2020/02/24