|
@@ -67,6 +67,7 @@
|
|
|
#include "options.h"
|
|
|
#include "sysemu/dirtylimit.h"
|
|
|
#include "qemu/sockets.h"
|
|
|
+#include "sysemu/kvm.h"
|
|
|
|
|
|
static NotifierList migration_state_notifiers =
|
|
|
NOTIFIER_LIST_INITIALIZER(migration_state_notifiers);
|
|
@@ -128,11 +129,17 @@ static bool migration_needs_multiple_sockets(void)
|
|
|
return migrate_multifd() || migrate_postcopy_preempt();
|
|
|
}
|
|
|
|
|
|
-static bool transport_supports_multi_channels(SocketAddress *saddr)
|
|
|
+static bool transport_supports_multi_channels(MigrationAddress *addr)
|
|
|
{
|
|
|
- return saddr->type == SOCKET_ADDRESS_TYPE_INET ||
|
|
|
- saddr->type == SOCKET_ADDRESS_TYPE_UNIX ||
|
|
|
- saddr->type == SOCKET_ADDRESS_TYPE_VSOCK;
|
|
|
+ if (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) {
|
|
|
+ SocketAddress *saddr = &addr->u.socket;
|
|
|
+
|
|
|
+ return saddr->type == SOCKET_ADDRESS_TYPE_INET ||
|
|
|
+ saddr->type == SOCKET_ADDRESS_TYPE_UNIX ||
|
|
|
+ saddr->type == SOCKET_ADDRESS_TYPE_VSOCK;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
static bool
|
|
@@ -140,8 +147,7 @@ migration_channels_and_transport_compatible(MigrationAddress *addr,
|
|
|
Error **errp)
|
|
|
{
|
|
|
if (migration_needs_multiple_sockets() &&
|
|
|
- (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) &&
|
|
|
- !transport_supports_multi_channels(&addr->u.socket)) {
|
|
|
+ !transport_supports_multi_channels(addr)) {
|
|
|
error_setg(errp, "Migration requires multi-channel URIs (e.g. tcp)");
|
|
|
return false;
|
|
|
}
|
|
@@ -311,7 +317,7 @@ void migration_incoming_state_destroy(void)
|
|
|
{
|
|
|
struct MigrationIncomingState *mis = migration_incoming_get_current();
|
|
|
|
|
|
- multifd_load_cleanup();
|
|
|
+ multifd_recv_cleanup();
|
|
|
compress_threads_load_cleanup();
|
|
|
|
|
|
if (mis->to_src_file) {
|
|
@@ -662,7 +668,7 @@ static void process_incoming_migration_bh(void *opaque)
|
|
|
|
|
|
trace_vmstate_downtime_checkpoint("dst-precopy-bh-announced");
|
|
|
|
|
|
- multifd_load_shutdown();
|
|
|
+ multifd_recv_shutdown();
|
|
|
|
|
|
dirty_bitmap_mig_before_vm_start();
|
|
|
|
|
@@ -759,7 +765,7 @@ fail:
|
|
|
MIGRATION_STATUS_FAILED);
|
|
|
qemu_fclose(mis->from_src_file);
|
|
|
|
|
|
- multifd_load_cleanup();
|
|
|
+ multifd_recv_cleanup();
|
|
|
compress_threads_load_cleanup();
|
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
@@ -885,7 +891,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp)
|
|
|
default_channel = !mis->from_src_file;
|
|
|
}
|
|
|
|
|
|
- if (multifd_load_setup(errp) != 0) {
|
|
|
+ if (multifd_recv_setup(errp) != 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -1331,7 +1337,7 @@ static void migrate_fd_cleanup(MigrationState *s)
|
|
|
}
|
|
|
bql_lock();
|
|
|
|
|
|
- multifd_save_cleanup();
|
|
|
+ multifd_send_shutdown();
|
|
|
qemu_mutex_lock(&s->qemu_file_lock);
|
|
|
tmp = s->to_dst_file;
|
|
|
s->to_dst_file = NULL;
|
|
@@ -1906,6 +1912,12 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ if (kvm_hwpoisoned_mem()) {
|
|
|
+ error_setg(errp, "Can't migrate this vm with hardware poisoned memory, "
|
|
|
+ "please reboot the vm and try again");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
if (migration_is_blocked(errp)) {
|
|
|
return false;
|
|
|
}
|
|
@@ -3315,6 +3327,10 @@ static void *migration_thread(void *opaque)
|
|
|
object_ref(OBJECT(s));
|
|
|
update_iteration_initial_status(s);
|
|
|
|
|
|
+ if (!multifd_send_setup()) {
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
+
|
|
|
bql_lock();
|
|
|
qemu_savevm_state_header(s->to_dst_file);
|
|
|
bql_unlock();
|
|
@@ -3386,6 +3402,7 @@ static void *migration_thread(void *opaque)
|
|
|
urgent = migration_rate_limit();
|
|
|
}
|
|
|
|
|
|
+out:
|
|
|
trace_migration_thread_after_loop();
|
|
|
migration_iteration_finish(s);
|
|
|
object_unref(OBJECT(s));
|
|
@@ -3623,15 +3640,6 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (multifd_save_setup(&local_err) != 0) {
|
|
|
- migrate_set_error(s, local_err);
|
|
|
- error_report_err(local_err);
|
|
|
- migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,
|
|
|
- MIGRATION_STATUS_FAILED);
|
|
|
- migrate_fd_cleanup(s);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
if (migrate_background_snapshot()) {
|
|
|
qemu_thread_create(&s->thread, "bg_snapshot",
|
|
|
bg_migration_thread, s, QEMU_THREAD_JOINABLE);
|