qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 1/1] qemu-nbd: add the option to use pre-crea


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH v2 1/1] qemu-nbd: add the option to use pre-created server socket
Date: Tue, 4 Oct 2016 12:09:44 +0100
User-agent: Mutt/1.7.0 (2016-08-17)

On Tue, Oct 04, 2016 at 02:03:01PM +0300, Denis V. Lunev wrote:
> From: Denis Plotnikov <address@hidden>
> 
> The NBD server socket was created by qemu-nbd code. This could lead to the
> race issue when the management layer started qemu-nbd server and allowed
> a client to connect to the server, the client tried to connect to the
> server but failed because qemu-nbd had not managed to open the listening
> server socket by the time the client has finished its trying to connect.
> 
> Creating a listening socket before starting of qemu-ndb and passing the
> socket fd to be used as the server socket to qemu-nbd as an option solves
> this issue.
> 
> It also helps to resolve the situation when qemu-nbd started by some
> management software should report the port number qemu-nbd bound to, to
> another piece of software. Right now, there is no good way to do that
> except to start the qemu-nbd to make sure that the certain port has been
> actually aquired. Otherwise, it is definitely racy to try to define the
> port first and then start the qemu-nbd, hoping that the port defined is
> still available. Passing of the pre-created file descriptor resolves this
> situation as well.
> 
> As a plus, pre-creating of the server socket adds some degree of freedom in
> setting of the socket properties. It is so, because once qemu-nbd gets
> the socket fd, it starts using it as is, without any additional
> modifications.
> 
> Signed-off-by: Denis Plotnikov <address@hidden>
> Reviewed-by: Roman Kagan <address@hidden>
> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Paolo Bonzini <address@hidden>
> ---
>  qemu-nbd.c    | 95 
> +++++++++++++++++++++++++++++++++++++++++++++++++++--------
>  qemu-nbd.texi |  6 ++++
>  2 files changed, 89 insertions(+), 12 deletions(-)
> 
> Changes from v1:
> - commit message improvements
> - Eric's style nits applied

It seems you've ignored the suggestion to implement the systemd socket
activation protocol, which would avoid the need for any new command
line parameters, and would let qemu-nbd "just work" with systemd units
too.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]