On Mon, Jun 09, 2025 at 09:12:27AM -0400, Steven Sistare wrote:
> On 6/9/2025 4:06 AM, Daniel P. Berrangé wrote:
> > On Fri, Jun 06, 2025 at 03:37:56PM -0400, Steven Sistare wrote:
> > >
> > > The easiest solution, with no interface changes, is adding
> > > wait_for_socket() in qtest,
> > > with this addition from Daniel:
> > >
> > > "With the busy wait you risk looping forever if the child (target) QEMU
> > > already exited for some reason without ever creating the socket. You
> > > can mitigate this by using 'kill($PID, 0)' in the loop and looking
> > > for -ERSCH, but this only works if you know the pid involved."
> > >
> > > Daniel also suggested:
> > > "For the tests, passing a pre-opened UNIX socket FD could work"
> > >
> > > Note we can not use any of the standard chardev options to specify such a
> > > socket,
> > > because the cpr socket is created before chardevs are created.
> > >
> > > Perhaps we could specify the fd in an extension of the MigrationChannel
> > > MigrationAddress.
> > > { 'union': 'MigrationAddress',
> > > 'base': { 'transport' : 'MigrationAddressType'},
> > > 'discriminator': 'transport',
> > > 'data': {
> > > 'socket': 'SocketAddress',
> > > 'exec': 'MigrationExecCommand',
> > > 'rdma': 'InetSocketAddress',
> > > 'file': 'FileMigrationArgs',
> > > 'fd': 'FdMigrationArgs' } } <-- add this
> > >
> > > That would be useful for all clients, but this is asking a lot from you,
> > > when you are just trying to fix the tests.
> >
> > Note, 'SocketAddress' already has an option for declaring a FD that
> > represents a socket.
>
> Yes, but if I understand, you proposed passing an fd that represents a
> pre-listened socket, which requires target qemu to accept() first. The
> existing FdSocketAddress is ready to read. We could add a boolean to enable
> the new behavior.
It can do both actually - it depends on what APIs the QEMU uses the
SocketAddress with.
If it is used with qio_channel_socket_connect* the FD must be an
active peer connection.
If it is used with qio_channel_socket_listen*/qio_net_listener* the
FD must be listener socket.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|