[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 05/47] Create MigrationIncomingState
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PATCH v6 05/47] Create MigrationIncomingState |
Date: |
Tue, 14 Apr 2015 18:03:31 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
There are currently lots of pieces of incoming migration state scattered
around, and postcopy is adding more, and it seems better to try and keep
it together.
allocate MIS in process_incoming_migration_co
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
include/migration/migration.h | 9 +++++++++
include/qemu/typedefs.h | 1 +
migration/migration.c | 28 ++++++++++++++++++++++++++++
savevm.c | 2 ++
4 files changed, 40 insertions(+)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index bf09968..7a6f521 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -42,6 +42,15 @@ struct MigrationParams {
typedef struct MigrationState MigrationState;
+/* State for the incoming migration */
+struct MigrationIncomingState {
+ QEMUFile *file;
+};
+
+MigrationIncomingState *migration_incoming_get_current(void);
+MigrationIncomingState *migration_incoming_state_new(QEMUFile *f);
+void migration_incoming_state_destroy(void);
+
struct MigrationState
{
int64_t bandwidth_limit;
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index cde3314..74dfad3 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -38,6 +38,7 @@ typedef struct MemoryListener MemoryListener;
typedef struct MemoryMappingList MemoryMappingList;
typedef struct MemoryRegion MemoryRegion;
typedef struct MemoryRegionSection MemoryRegionSection;
+typedef struct MigrationIncomingState MigrationIncomingState;
typedef struct MigrationParams MigrationParams;
typedef struct Monitor Monitor;
typedef struct MouseTransformInfo MouseTransformInfo;
diff --git a/migration/migration.c b/migration/migration.c
index ce6c2e3..ce488cf 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -45,6 +45,7 @@ static bool deferred_incoming;
migrations at once. For now we don't need to add
dynamic creation of migration */
+/* For outgoing */
MigrationState *migrate_get_current(void)
{
static MigrationState current_migration = {
@@ -57,6 +58,28 @@ MigrationState *migrate_get_current(void)
return ¤t_migration;
}
+/* For incoming */
+static MigrationIncomingState *mis_current;
+
+MigrationIncomingState *migration_incoming_get_current(void)
+{
+ return mis_current;
+}
+
+MigrationIncomingState *migration_incoming_state_new(QEMUFile* f)
+{
+ mis_current = g_malloc0(sizeof(MigrationIncomingState));
+ mis_current->file = f;
+
+ return mis_current;
+}
+
+void migration_incoming_state_destroy(void)
+{
+ g_free(mis_current);
+ mis_current = NULL;
+}
+
/*
* Called on -incoming with a defer: uri.
* The migration can be started later after any parameters have been
@@ -101,9 +124,14 @@ static void process_incoming_migration_co(void *opaque)
Error *local_err = NULL;
int ret;
+ migration_incoming_state_new(f);
+
ret = qemu_loadvm_state(f);
+
qemu_fclose(f);
free_xbzrle_decoded_buf();
+ migration_incoming_state_destroy();
+
if (ret < 0) {
error_report("load of migration failed: %s", strerror(-ret));
exit(EXIT_FAILURE);
diff --git a/savevm.c b/savevm.c
index 9795e2e..81f6a29 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1320,9 +1320,11 @@ int load_vmstate(const char *name)
}
qemu_system_reset(VMRESET_SILENT);
+ migration_incoming_state_new(f);
ret = qemu_loadvm_state(f);
qemu_fclose(f);
+ migration_incoming_state_destroy();
if (ret < 0) {
error_report("Error %d while loading VM state", ret);
return ret;
--
2.1.0
- [Qemu-devel] [PATCH v6 00/47] Postcopy implementation, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 02/47] Split header writing out of qemu_savevm_state_begin, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 01/47] Start documenting how postcopy works., Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 04/47] Add qemu_get_counted_string to read a string prefixed by a count byte, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 03/47] qemu_ram_foreach_block: pass up error value, and down the ramblock name, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 05/47] Create MigrationIncomingState,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PATCH v6 06/47] Provide runtime Target page information, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 09/47] Add wrapper for setting blocking status on a QEMUFile, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 07/47] Move copy out of qemu_peek_buffer, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 13/47] Migration commands, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 10/47] Rename save_live_complete to save_live_complete_precopy, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 12/47] Return path: socket_writev_buffer: Block even on non-blocking fd's, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 08/47] Add qemu_get_buffer_less_copy to avoid copies some of the time, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 11/47] Return path: Open a return path on QEMUFile for sockets, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 15/47] Return path: Send responses from destination to source, Dr. David Alan Gilbert (git), 2015/04/14
- [Qemu-devel] [PATCH v6 14/47] Return path: Control commands, Dr. David Alan Gilbert (git), 2015/04/14