61 lines
1.7 KiB
Diff
61 lines
1.7 KiB
Diff
|
|
From d41206e959717f68a31da4a2d875d33035baeb9f Mon Sep 17 00:00:00 2001
|
||
|
|
From: Chuan Zheng <zhengchuan@huawei.com>
|
||
|
|
Date: Mon, 29 Jul 2019 16:22:12 +0800
|
||
|
|
Subject: [PATCH 08/14] vhost: cancel migration when vhost-user restarted
|
||
|
|
during migraiton
|
||
|
|
|
||
|
|
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 temporarily
|
||
|
|
lost. Let's cancel migraiton and report it to user in this abnormal
|
||
|
|
situation.
|
||
|
|
|
||
|
|
Signed-off-by: Ying Fang <fangying1@huawei.com>
|
||
|
|
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
|
||
|
|
---
|
||
|
|
hw/virtio/vhost.c | 9 +++++++--
|
||
|
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
|
||
|
|
index 437347ad01..dafb23c481 100644
|
||
|
|
--- a/hw/virtio/vhost.c
|
||
|
|
+++ b/hw/virtio/vhost.c
|
||
|
|
@@ -25,6 +25,7 @@
|
||
|
|
#include "hw/virtio/virtio-access.h"
|
||
|
|
#include "migration/blocker.h"
|
||
|
|
#include "migration/qemu-file-types.h"
|
||
|
|
+#include "migration/migration.h"
|
||
|
|
#include "sysemu/dma.h"
|
||
|
|
#include "sysemu/tcg.h"
|
||
|
|
#include "trace.h"
|
||
|
|
@@ -947,20 +948,24 @@ check_dev_state:
|
||
|
|
static void vhost_log_global_start(MemoryListener *listener)
|
||
|
|
{
|
||
|
|
int r;
|
||
|
|
+ Error *errp = NULL;
|
||
|
|
|
||
|
|
r = vhost_migration_log(listener, true);
|
||
|
|
if (r < 0) {
|
||
|
|
- abort();
|
||
|
|
+ error_setg(&errp, "Failed to start vhost migration log");
|
||
|
|
+ migrate_fd_error(migrate_get_current(), errp);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
static void vhost_log_global_stop(MemoryListener *listener)
|
||
|
|
{
|
||
|
|
int r;
|
||
|
|
+ Error *errp = NULL;
|
||
|
|
|
||
|
|
r = vhost_migration_log(listener, false);
|
||
|
|
if (r < 0) {
|
||
|
|
- abort();
|
||
|
|
+ error_setg(&errp, "Failed to stop vhost migration log");
|
||
|
|
+ migrate_fd_error(migrate_get_current(), errp);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|