Abuse the VHOST_USER_SEND_RARP command to do operations that need to happen very late on the target side migration. Nothing is in there now and with some luck we'll be able to drop this completely before merge. Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com> Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- migrate.c | 11 +++++++++++ migrate.h | 1 + vhost_user.c | 3 +++ 3 files changed, 15 insertions(+) diff --git a/migrate.c b/migrate.c index ebbe47f3..6b386f7f 100644 --- a/migrate.c +++ b/migrate.c @@ -270,3 +270,14 @@ void migrate_handler(struct ctx *c) c->device_state_result = rc; } + +/** + * migrate_finish() - Hack to connect() migrated sockets from "RARP" trigger + * @c: Execution context + */ +void migrate_finish(struct ctx *c) +{ + (void)c; + + /* HACK RARP: flow_migrate_target_post(c); */ +} diff --git a/migrate.h b/migrate.h index 80d78b84..9694af64 100644 --- a/migrate.h +++ b/migrate.h @@ -49,5 +49,6 @@ void migrate_init(struct ctx *c); void migrate_close(struct ctx *c); void migrate_request(struct ctx *c, int fd, bool target); void migrate_handler(struct ctx *c); +void migrate_finish(struct ctx *c); #endif /* MIGRATE_H */ diff --git a/vhost_user.c b/vhost_user.c index 8077f1d8..afc977b8 100644 --- a/vhost_user.c +++ b/vhost_user.c @@ -995,6 +995,9 @@ static bool vu_send_rarp_exec(struct vu_dev *vdev, eth_ntop((unsigned char *)&msg->payload.u64, macstr, sizeof(macstr))); + /* Abuse this as trigger to finally connect() migrated sockets */ + migrate_finish(vdev->context); + return false; } -- 2.48.1