From: Marc-André Lureau <marcandre.lur...@redhat.com> If VHOST_USER_PROTOCOL_F_LOG_SHMFD is not announced, block vhost-user migration.
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- hw/virtio/vhost-user.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index cf14e38..cef4aae 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 (!virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_LOG_SHMFD)) { + migrate_add_blocker(dev->migration_blocker); + error_setg(&dev->migration_blocker, + "Migration disabled: vhost-user backend lacks " + "VHOST_USER_PROTOCOL_F_LOG_SHMFD feature."); + } + return 0; } @@ -466,6 +475,10 @@ static int vhost_user_cleanup(struct vhost_dev *dev) assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER); dev->opaque = 0; + if (dev->migration_blocker) { + migrate_del_blocker(dev->migration_blocker); + error_free(dev->migration_blocker); + } return 0; } -- 2.4.3