mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
vhost-user: add a migration blocker
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 <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
This commit is contained in:
parent
9a78a5dd27
commit
d2fc4402cb
2 changed files with 21 additions and 4 deletions
|
@ -961,6 +961,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;
|
||||
|
@ -1012,12 +1014,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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue