summaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2017-04-24 20:07:27 +0200
committerJuan Quintela <quintela@redhat.com>2017-06-13 11:00:45 +0200
commit6666c96aac9151568736226dec99aa8acb14d07c (patch)
tree4cbf369d8eb33dfa4ca462ab27dc8956bcb879bf /migration
parentc4b63b7cc5e566448498d0daa7059a27a9d3bf00 (diff)
migration: Move migration.h to migration/
Nothing uses it outside of migration.h Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/block.c2
-rw-r--r--migration/channel.c2
-rw-r--r--migration/colo-comm.c2
-rw-r--r--migration/colo.c2
-rw-r--r--migration/exec.c2
-rw-r--r--migration/fd.c2
-rw-r--r--migration/migration.c2
-rw-r--r--migration/migration.h164
-rw-r--r--migration/postcopy-ram.c2
-rw-r--r--migration/qemu-file.c2
-rw-r--r--migration/ram.c2
-rw-r--r--migration/rdma.c2
-rw-r--r--migration/savevm.c2
-rw-r--r--migration/socket.c2
-rw-r--r--migration/tls.c2
-rw-r--r--migration/vmstate-types.c2
-rw-r--r--migration/vmstate.c2
17 files changed, 180 insertions, 16 deletions
diff --git a/migration/block.c b/migration/block.c
index 223ecaa20f..ae06975199 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -25,7 +25,7 @@
#include "qemu/timer.h"
#include "block.h"
#include "migration/misc.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "migration/register.h"
#include "sysemu/blockdev.h"
#include "qemu-file.h"
diff --git a/migration/channel.c b/migration/channel.c
index 92f6f996a5..3b7252f5a2 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -13,7 +13,7 @@
#include "qemu/osdep.h"
#include "channel.h"
#include "tls.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "qemu-file-channel.h"
#include "trace.h"
#include "qapi/error.h"
diff --git a/migration/colo-comm.c b/migration/colo-comm.c
index 8bfdf6825a..b61aa19a38 100644
--- a/migration/colo-comm.c
+++ b/migration/colo-comm.c
@@ -12,7 +12,7 @@
*/
#include "qemu/osdep.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "migration/colo.h"
#include "migration/vmstate.h"
#include "trace.h"
diff --git a/migration/colo.c b/migration/colo.c
index 111b715546..45e9b46289 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -14,7 +14,7 @@
#include "qemu/timer.h"
#include "sysemu/sysemu.h"
#include "qemu-file-channel.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "qemu-file.h"
#include "savevm.h"
#include "migration/colo.h"
diff --git a/migration/exec.c b/migration/exec.c
index fc78eeba69..b1de44543a 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -22,7 +22,7 @@
#include "qemu-common.h"
#include "channel.h"
#include "exec.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "io/channel-command.h"
#include "trace.h"
diff --git a/migration/fd.c b/migration/fd.c
index 8a04dcd38c..b2384bf133 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -19,7 +19,7 @@
#include "qemu-common.h"
#include "channel.h"
#include "fd.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "monitor/monitor.h"
#include "io/channel-util.h"
#include "trace.h"
diff --git a/migration/migration.c b/migration/migration.c
index e824c5f8ee..8ef6d6c412 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -25,7 +25,7 @@
#include "ram.h"
#include "migration/global_state.h"
#include "migration/misc.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "savevm.h"
#include "qemu-file-channel.h"
#include "qemu-file.h"
diff --git a/migration/migration.h b/migration/migration.h
new file mode 100644
index 0000000000..601e4ab354
--- /dev/null
+++ b/migration/migration.h
@@ -0,0 +1,164 @@
+/*
+ * QEMU live migration
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_H
+#define QEMU_MIGRATION_H
+
+#include "qapi/qmp/qdict.h"
+#include "qemu-common.h"
+#include "qemu/thread.h"
+#include "qemu/notify.h"
+#include "qapi-types.h"
+#include "exec/cpu-common.h"
+#include "qemu/coroutine_int.h"
+
+/* State for the incoming migration */
+struct MigrationIncomingState {
+ QEMUFile *from_src_file;
+
+ /*
+ * Free at the start of the main state load, set as the main thread finishes
+ * loading state.
+ */
+ QemuEvent main_thread_load_event;
+
+ size_t largest_page_size;
+ bool have_fault_thread;
+ QemuThread fault_thread;
+ QemuSemaphore fault_thread_sem;
+
+ bool have_listen_thread;
+ QemuThread listen_thread;
+ QemuSemaphore listen_thread_sem;
+
+ /* For the kernel to send us notifications */
+ int userfault_fd;
+ /* To tell the fault_thread to quit */
+ int userfault_quit_fd;
+ QEMUFile *to_src_file;
+ QemuMutex rp_mutex; /* We send replies from multiple threads */
+ void *postcopy_tmp_page;
+ void *postcopy_tmp_zero_page;
+
+ QEMUBH *bh;
+
+ int state;
+
+ bool have_colo_incoming_thread;
+ QemuThread colo_incoming_thread;
+ /* The coroutine we should enter (back) after failover */
+ Coroutine *migration_incoming_co;
+ QemuSemaphore colo_incoming_sem;
+};
+
+MigrationIncomingState *migration_incoming_get_current(void);
+void migration_incoming_state_destroy(void);
+
+struct MigrationState
+{
+ size_t bytes_xfer;
+ size_t xfer_limit;
+ QemuThread thread;
+ QEMUBH *cleanup_bh;
+ QEMUFile *to_dst_file;
+
+ /* params from 'migrate-set-parameters' */
+ MigrationParameters parameters;
+
+ int state;
+
+ /* State related to return path */
+ struct {
+ QEMUFile *from_dst_file;
+ QemuThread rp_thread;
+ bool error;
+ } rp_state;
+
+ double mbps;
+ int64_t total_time;
+ int64_t downtime;
+ int64_t expected_downtime;
+ bool enabled_capabilities[MIGRATION_CAPABILITY__MAX];
+ int64_t xbzrle_cache_size;
+ int64_t setup_time;
+
+ /* Flag set once the migration has been asked to enter postcopy */
+ bool start_postcopy;
+ /* Flag set after postcopy has sent the device state */
+ bool postcopy_after_devices;
+
+ /* Flag set once the migration thread is running (and needs joining) */
+ bool migration_thread_running;
+
+ /* Flag set once the migration thread called bdrv_inactivate_all */
+ bool block_inactive;
+
+ /* The semaphore is used to notify COLO thread that failover is finished */
+ QemuSemaphore colo_exit_sem;
+
+ /* The semaphore is used to notify COLO thread to do checkpoint */
+ QemuSemaphore colo_checkpoint_sem;
+ int64_t colo_checkpoint_time;
+ QEMUTimer *colo_delay_timer;
+
+ /* The last error that occurred */
+ Error *error;
+ /* Do we have to clean up -b/-i from old migrate parameters */
+ /* This feature is deprecated and will be removed */
+ bool must_remove_block_options;
+};
+
+void migrate_set_state(int *state, int old_state, int new_state);
+
+void migration_fd_process_incoming(QEMUFile *f);
+
+uint64_t migrate_max_downtime(void);
+
+void migrate_fd_error(MigrationState *s, const Error *error);
+
+void migrate_fd_connect(MigrationState *s);
+
+MigrationState *migrate_init(void);
+bool migration_is_blocked(Error **errp);
+/* True if outgoing migration has entered postcopy phase */
+bool migration_in_postcopy(void);
+MigrationState *migrate_get_current(void);
+
+bool migrate_release_ram(void);
+bool migrate_postcopy_ram(void);
+bool migrate_zero_blocks(void);
+
+bool migrate_auto_converge(void);
+
+int migrate_use_xbzrle(void);
+int64_t migrate_xbzrle_cache_size(void);
+bool migrate_colo_enabled(void);
+
+bool migrate_use_block(void);
+bool migrate_use_block_incremental(void);
+
+bool migrate_use_compression(void);
+int migrate_compress_level(void);
+int migrate_compress_threads(void);
+int migrate_decompress_threads(void);
+bool migrate_use_events(void);
+
+/* Sending on the return path - generic and then for each message type */
+void migrate_send_rp_shut(MigrationIncomingState *mis,
+ uint32_t value);
+void migrate_send_rp_pong(MigrationIncomingState *mis,
+ uint32_t value);
+void migrate_send_rp_req_pages(MigrationIncomingState *mis, const char* rbname,
+ ram_addr_t start, size_t len);
+
+#endif
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 9c4188724e..c8c4500cc4 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -20,7 +20,7 @@
#include "qemu-common.h"
#include "exec/target_page.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "qemu-file.h"
#include "savevm.h"
#include "postcopy-ram.h"
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index ab26f4eea9..e65c373341 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -28,7 +28,7 @@
#include "qemu/iov.h"
#include "qemu/sockets.h"
#include "qemu/coroutine.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "qemu-file.h"
#include "trace.h"
diff --git a/migration/ram.c b/migration/ram.c
index d8b6713c4a..c1b4f4abf3 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -37,7 +37,7 @@
#include "qemu/main-loop.h"
#include "xbzrle.h"
#include "ram.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "migration/register.h"
#include "migration/misc.h"
#include "qemu-file.h"
diff --git a/migration/rdma.c b/migration/rdma.c
index e446c6fd6a..c6bc607a03 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -18,7 +18,7 @@
#include "qemu-common.h"
#include "qemu/cutils.h"
#include "rdma.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "qemu-file.h"
#include "ram.h"
#include "qemu-file-channel.h"
diff --git a/migration/savevm.c b/migration/savevm.c
index 28d00caa37..30cda2cb46 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -34,7 +34,7 @@
#include "net/net.h"
#include "sysemu/sysemu.h"
#include "qemu/timer.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "migration/snapshot.h"
#include "migration/misc.h"
#include "migration/register.h"
diff --git a/migration/socket.c b/migration/socket.c
index 50dc8d8ebc..757d3821a1 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -21,7 +21,7 @@
#include "qapi/error.h"
#include "channel.h"
#include "socket.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "qemu-file.h"
#include "io/channel-socket.h"
#include "trace.h"
diff --git a/migration/tls.c b/migration/tls.c
index d3abd6e131..596e8790bd 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -20,7 +20,7 @@
#include "qemu/osdep.h"
#include "channel.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "tls.h"
#include "io/channel-tls.h"
#include "crypto/tlscreds.h"
diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
index 7287c6baa6..02f05a3359 100644
--- a/migration/vmstate-types.c
+++ b/migration/vmstate-types.c
@@ -14,7 +14,7 @@
#include "qemu-common.h"
#include "exec/cpu-common.h"
#include "qemu-file.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "migration/vmstate.h"
#include "qemu/error-report.h"
#include "qemu/queue.h"
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 377d9515f3..3226e8eb45 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -12,7 +12,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
-#include "migration/migration.h"
+#include "migration.h"
#include "migration/vmstate.h"
#include "migration/savevm.h"
#include "qemu-file.h"