[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/25] vhost-user: add a migration blocker
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 11/25] vhost-user: add a migration blocker |
Date: |
Fri, 9 Oct 2015 00:17:16 +0300 |
From: Marc-André Lureau <address@hidden>
If VHOST_USER_PROTOCOL_F_LOG_SHMFD is not announced, block vhost-user
migration. The blocker is removed in vhost_dev_cleanup().
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/virtio/vhost-user.c | 9 +++++++++
hw/virtio/vhost.c | 16 ++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index cf14e38..f1edd04 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -15,6 +15,7 @@
#include "qemu/error-report.h"
#include "qemu/sockets.h"
#include "exec/ram_addr.h"
+#include "migration/migration.h"
#include <fcntl.h>
#include <unistd.h>
@@ -442,6 +443,14 @@ static int vhost_user_init(struct vhost_dev *dev, void
*opaque)
}
}
+ if (dev->migration_blocker == NULL &&
+ !virtio_has_feature(dev->protocol_features,
+ VHOST_USER_PROTOCOL_F_LOG_SHMFD)) {
+ error_setg(&dev->migration_blocker,
+ "Migration disabled: vhost-user backend lacks "
+ "VHOST_USER_PROTOCOL_F_LOG_SHMFD feature.");
+ }
+
return 0;
}
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index d1c0367..554e49d 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -944,6 +944,8 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
uint64_t features;
int i, r;
+ hdev->migration_blocker = NULL;
+
if (vhost_set_backend_type(hdev, backend_type) < 0) {
close((uintptr_t)opaque);
return -1;
@@ -987,12 +989,18 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
.eventfd_del = vhost_eventfd_del,
.priority = 10
};
- hdev->migration_blocker = NULL;
- if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) {
- error_setg(&hdev->migration_blocker,
- "Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.");
+
+ if (hdev->migration_blocker == NULL) {
+ if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) {
+ error_setg(&hdev->migration_blocker,
+ "Migration disabled: vhost lacks VHOST_F_LOG_ALL
feature.");
+ }
+ }
+
+ if (hdev->migration_blocker != NULL) {
migrate_add_blocker(hdev->migration_blocker);
}
+
hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions));
hdev->n_mem_sections = 0;
hdev->mem_sections = NULL;
--
MST
- [Qemu-devel] [PULL 09/25] vhost: alloc shareable log, (continued)
- [Qemu-devel] [PULL 09/25] vhost: alloc shareable log, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 10/25] vhost-user: send log shm fd along with log_base, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 13/25] vhost-user: document migration log, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 14/25] net: add trace_vhost_user_event, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 15/25] vhost user: add support of live migration, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 20/25] vhost-user-test: remove useless static check, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 21/25] vhost-user-test: wrap server in TestServer struct, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 24/25] vhost-user-test: check ownership during migration, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 22/25] vhost-user-test: learn to tweak various qemu arguments, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 25/25] intel_iommu: Add support for translation for devices behind bridges, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 11/25] vhost-user: add a migration blocker,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 08/25] vhost-user: add vhost_user_requires_shm_log(), Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 23/25] vhost-user-test: add live-migration test, Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 18/25] vhost: add migration block if memfd failed, Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 02/25] linux-headers: add unistd.h, Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 12/25] vhost: use a function for each call, Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 16/25] vhost user: add rarp sending after live migration for legacy guest, Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 17/25] vhost-user: use an enum helper for features mask, Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 19/25] vhost-user-test: move wait_for_fds() out, Michael S. Tsirkin, 2015/10/09