From: "Michael R. Hines" <mrhi...@us.ibm.com>

Expose the prototypes of the serialization code and register the
save/load functions during QEMU startup so that they can take effect.

Signed-off-by: Michael R. Hines <mrhi...@us.ibm.com>
---
 include/migration/migration.h | 8 ++++++++
 vl.c                          | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 3e1e6c7..b5d4e6f 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -53,6 +53,7 @@ struct MigrationState
     int state;
     MigrationParams params;
     double mbps;
+    int64_t start_time;
     int64_t total_time;
     int64_t downtime;
     int64_t expected_downtime;
@@ -61,6 +62,8 @@ struct MigrationState
     bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
     int64_t xbzrle_cache_size;
     int64_t setup_time;
+    MigrationInfo *last_info;
+    bool migrated_before;
 };
 
 void process_incoming_migration(QEMUFile *f);
@@ -174,4 +177,9 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t 
block_offset,
                              ram_addr_t offset, size_t size,
                              int *bytes_sent);
 
+#define STATS_VERSION 1
+
+int migrate_info_load(QEMUFile *f, void *opaque, int version_id);
+void migrate_info_save(QEMUFile *f, void *opaque);
+
 #endif
diff --git a/vl.c b/vl.c
index 316de54..b9f3661 100644
--- a/vl.c
+++ b/vl.c
@@ -4138,6 +4138,8 @@ int main(int argc, char **argv, char **envp)
     default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
 
     register_savevm_live(NULL, "ram", 0, 4, &savevm_ram_handlers, NULL);
+    register_savevm(NULL, "info", -1, STATS_VERSION, migrate_info_save,
+                        migrate_info_load, NULL);
 
     if (nb_numa_nodes > 0) {
         int i;
-- 
1.8.1.2


Reply via email to