Acked-by: Raphael Norwitz <[email protected]>
On Thu, Oct 16, 2025 at 7:46 AM Vladimir Sementsov-Ogievskiy <[email protected]> wrote: > > That's a preparation for further backend-transfer migration for > vhost-user-blk. At initialization time we don't know will > user enable backent-transfer (by setting migration parameter) or > not. At time of pre-incoming, we know all migration parameters and > capabilities. So, now, let's postpone connecting up to pre-incoming > for incoming migration. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> > --- > hw/block/vhost-user-blk.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c > index af4a97b8e4..ffdd600526 100644 > --- a/hw/block/vhost-user-blk.c > +++ b/hw/block/vhost-user-blk.c > @@ -577,8 +577,10 @@ static void vhost_user_blk_device_realize(DeviceState > *dev, Error **errp) > goto fail; > } > > - if (vhost_user_blk_realize_connect_loop(s, errp) < 0) { > - goto fail; > + if (!runstate_check(RUN_STATE_INMIGRATE)) { > + if (vhost_user_blk_realize_connect_loop(s, errp) < 0) { > + goto fail; > + } > } > > trace_vhost_user_blk_device_realize_out(vdev); > @@ -636,10 +638,18 @@ static struct vhost_dev > *vhost_user_blk_get_vhost(VirtIODevice *vdev) > return &s->dev; > } > > +static bool vhost_user_blk_pre_incoming(void *opaque, Error **errp) > +{ > + VHostUserBlk *s = VHOST_USER_BLK(opaque); > + > + return vhost_user_blk_realize_connect(s, errp) == 0; > +} > + > static const VMStateDescription vmstate_vhost_user_blk = { > .name = "vhost-user-blk", > .minimum_version_id = 1, > .version_id = 1, > + .pre_incoming = vhost_user_blk_pre_incoming, > .fields = (const VMStateField[]) { > VMSTATE_VIRTIO_DEVICE, > VMSTATE_END_OF_LIST() > @@ -647,7 +657,7 @@ static const VMStateDescription vmstate_vhost_user_blk = { > }; > > static const Property vhost_user_blk_properties[] = { > - DEFINE_PROP_CHR("chardev", VHostUserBlk, chardev), > + DEFINE_PROP_CHR_NO_CONNECT("chardev", VHostUserBlk, chardev), > DEFINE_PROP_UINT16("num-queues", VHostUserBlk, num_queues, > VHOST_USER_BLK_AUTO_NUM_QUEUES), > DEFINE_PROP_UINT32("queue-size", VHostUserBlk, queue_size, 128), > -- > 2.48.1 > >
