QEMU will abort when vhost-user process is restarted during migration when vhost_log_global_start/stop is called. The reason is clear that vhost_dev_set_log returns -1 because network connection is lost.
To handle this situation, let's cancel migration by setting migrate state to failure and report it to user. --- hw/virtio/vhost.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index ddc42f0..92725f7 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -26,6 +26,8 @@ #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" #include "migration/blocker.h" +#include "migration/migration.h" +#include "migration/qemu-file.h" #include "sysemu/dma.h" /* enabled until disconnected backend stabilizes */ @@ -885,7 +887,10 @@ static void vhost_log_global_start(MemoryListener *listener) r = vhost_migration_log(listener, true); if (r < 0) { - abort(); + error_report("Failed to start vhost dirty log"); + if (migrate_get_current()->migration_thread_running) { + qemu_file_set_error(migrate_get_current()->to_dst_file, -ECHILD); + } } } @@ -895,7 +900,10 @@ static void vhost_log_global_stop(MemoryListener *listener) r = vhost_migration_log(listener, false); if (r < 0) { - abort(); + error_report("Failed to stop vhost dirty log"); + if (migrate_get_current()->migration_thread_running) { + qemu_file_set_error(migrate_get_current()->to_dst_file, -ECHILD); + } } } -- 1.8.3.1