diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2021-10-05 13:54:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 13:54:26 +0100 |
commit | 8d82bd5f20fac5d8b4dab510d2294e076a6dd93d (patch) | |
tree | cb287e9436e387d14ca0d81a2182dd10fca8bd86 /lib/migration.c | |
parent | e7f0fc73cdab811948adf5227c04f722a7c3105b (diff) | |
download | libvfio-user-8d82bd5f20fac5d8b4dab510d2294e076a6dd93d.zip libvfio-user-8d82bd5f20fac5d8b4dab510d2294e076a6dd93d.tar.gz libvfio-user-8d82bd5f20fac5d8b4dab510d2294e076a6dd93d.tar.bz2 |
make migration state callback optionally asynchronous (#608)
Some devices need the migration state callback to be asynchronous. The simplest way to implement this is to require from the callback to return -1 and set errno to EBUSY, not process any other new messages (vfu_ctx_run returns -1 and sets errno to EBUSY), and provide a way to the user to complete migration (vfu_migr_done).
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'lib/migration.c')
-rw-r--r-- | lib/migration.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/migration.c b/lib/migration.c index c1fe0b5..c8b97fa 100644 --- a/lib/migration.c +++ b/lib/migration.c @@ -423,6 +423,11 @@ MOCK_DEFINE(migration_region_access_registers)(vfu_ctx_t *vfu_ctx, char *buf, "migration: transition from state %s to state %s", migr_states[old_device_state].name, migr_states[*device_state].name); + } else if (errno == EBUSY) { + vfu_log(vfu_ctx, LOG_DEBUG, + "migration: transition from state %s to state %s deferred", + migr_states[old_device_state].name, + migr_states[*device_state].name); } else { vfu_log(vfu_ctx, LOG_ERR, "migration: failed to transition from state %s to state %s", |