mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
ivshmem: use migration blockers to prevent live migration in peer mode (v2)
Now when you try to migrate with ivshmem, you get a proper QMP error: (qemu) migrate tcp:localhost:1025 Migration is disabled when using feature 'peer mode' in device 'ivshmem' (qemu) Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
fa2756b71b
commit
38e0735eb7
4 changed files with 18 additions and 26 deletions
12
hw/ivshmem.c
12
hw/ivshmem.c
|
@ -18,6 +18,8 @@
|
|||
#include "pci.h"
|
||||
#include "msix.h"
|
||||
#include "kvm.h"
|
||||
#include "migration.h"
|
||||
#include "qerror.h"
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -78,6 +80,8 @@ typedef struct IVShmemState {
|
|||
uint32_t features;
|
||||
EventfdEntry *eventfd_table;
|
||||
|
||||
Error *migration_blocker;
|
||||
|
||||
char * shmobj;
|
||||
char * sizearg;
|
||||
char * role;
|
||||
|
@ -646,7 +650,8 @@ static int pci_ivshmem_init(PCIDevice *dev)
|
|||
}
|
||||
|
||||
if (s->role_val == IVSHMEM_PEER) {
|
||||
register_device_unmigratable(&s->dev.qdev, "ivshmem", s);
|
||||
error_set(&s->migration_blocker, QERR_DEVICE_FEATURE_BLOCKS_MIGRATION, "ivshmem", "peer mode");
|
||||
migrate_add_blocker(s->migration_blocker);
|
||||
}
|
||||
|
||||
pci_conf = s->dev.config;
|
||||
|
@ -741,6 +746,11 @@ static int pci_ivshmem_uninit(PCIDevice *dev)
|
|||
{
|
||||
IVShmemState *s = DO_UPCAST(IVShmemState, dev, dev);
|
||||
|
||||
if (s->migration_blocker) {
|
||||
migrate_del_blocker(s->migration_blocker);
|
||||
error_free(s->migration_blocker);
|
||||
}
|
||||
|
||||
memory_region_destroy(&s->ivshmem_mmio);
|
||||
memory_region_del_subregion(&s->bar, &s->ivshmem);
|
||||
memory_region_destroy(&s->ivshmem);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue