Hi folks, Xen''s qemu-dm version has a ''-vncunused'' command line switch which asks the internal vnc server to pick any unused tcp port to listen on. The actual port is communicated to the outside world via xenstore. I''m looking for a reasonable way to implement that functionality in upstream qemu. First, I think it shouldn''t be a separate command line switch but an option for the existion -vnc switch. Second, we need a way to communicate the port picked which isn''t xen-specific. Obvious choice is a monitor info subcommand. Comments? Other suggestions? cheers, Gerd -- http://kraxel.fedorapeople.org/xenner/ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Gerd Hoffmann wrote:> Hi folks, > > Xen''s qemu-dm version has a ''-vncunused'' command line switch which asks > the internal vnc server to pick any unused tcp port to listen on. The > actual port is communicated to the outside world via xenstore. > > I''m looking for a reasonable way to implement that functionality in > upstream qemu. First, I think it shouldn''t be a separate command line > switch but an option for the existion -vnc switch.Maybe something like a to=N option. So you would have: -vnc localhost:0,to=10 That would try from displays 0 to 10 and select the first one it could attach to.> Second, we need a > way to communicate the port picked which isn''t xen-specific. Obvious > choice is a monitor info subcommand. >There''s already an info vnc. It can be added to that. Regards, Anthony Liguori> Comments? Other suggestions? > > cheers, > Gerd > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Gerd Hoffmann wrote:> Hi folks, > > Xen''s qemu-dm version has a ''-vncunused'' command line switch which asks > the internal vnc server to pick any unused tcp port to listen on. The > actual port is communicated to the outside world via xenstore. > > I''m looking for a reasonable way to implement that functionality in > upstream qemu. First, I think it shouldn''t be a separate command line > switch but an option for the existion -vnc switch. Second, we need a > way to communicate the port picked which isn''t xen-specific. Obvious > choice is a monitor info subcommand. > > Comments? Other suggestions? > >Presumably -vncunused is passed by the management application, which knows about all domains. Can''t it figure out an unused port and pass it on? Alternatively, have the management application pass an fd denoting the socket. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Avi Kivity wrote:> Gerd Hoffmann wrote: >> Hi folks, >> >> Xen''s qemu-dm version has a ''-vncunused'' command line switch which asks >> the internal vnc server to pick any unused tcp port to listen on. The >> actual port is communicated to the outside world via xenstore. >> >> I''m looking for a reasonable way to implement that functionality in >> upstream qemu. First, I think it shouldn''t be a separate command line >> switch but an option for the existion -vnc switch. Second, we need a >> way to communicate the port picked which isn''t xen-specific. Obvious >> choice is a monitor info subcommand. >> >> Comments? Other suggestions? >> >> > > Presumably -vncunused is passed by the management application, which > knows about all domains. Can''t it figure out an unused port and pass > it on?An argument for this sort of semantics is that if you just launch vncserver with no argument, it''ll sit on the first unused port. So people are sort of used to this behavior.> Alternatively, have the management application pass an fd denoting the > socket.If you are allocating the ports in the management tool, then just tell QEMU what port to open up. I don''t think you gain anything passing an fd. Regards, Anthony Liguori _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel P. Berrange
2008-Aug-21 19:52 UTC
Re: [Xen-devel] Re: [Qemu-devel] vnc port selection
On Thu, Aug 21, 2008 at 09:30:21PM +0300, Avi Kivity wrote:> Gerd Hoffmann wrote: > > Hi folks, > > > >Xen''s qemu-dm version has a ''-vncunused'' command line switch which asks > >the internal vnc server to pick any unused tcp port to listen on. The > >actual port is communicated to the outside world via xenstore. > > > >I''m looking for a reasonable way to implement that functionality in > >upstream qemu. First, I think it shouldn''t be a separate command line > >switch but an option for the existion -vnc switch. Second, we need a > >way to communicate the port picked which isn''t xen-specific. Obvious > >choice is a monitor info subcommand. > > > >Comments? Other suggestions? > > > > > > Presumably -vncunused is passed by the management application, which > knows about all domains. Can''t it figure out an unused port and pass it on? >Yes & no. Yes, we do this in libvirt, but it open a race condition unless you pass the actual file descriptor to QEMU. In addition when we add IPv6 support to QEMU, you will actally have multiple sockets you need to listen on. It will make it far easier if we just do the right thing in QEMU, based on a command line flag. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel P. Berrange
2008-Aug-21 19:53 UTC
Re: [Xen-devel] Re: [Qemu-devel] vnc port selection
On Thu, Aug 21, 2008 at 01:35:57PM -0500, Anthony Liguori wrote:> Avi Kivity wrote: > >Gerd Hoffmann wrote: > >> Hi folks, > >> > >>Xen''s qemu-dm version has a ''-vncunused'' command line switch which asks > >>the internal vnc server to pick any unused tcp port to listen on. The > >>actual port is communicated to the outside world via xenstore. > >> > >>I''m looking for a reasonable way to implement that functionality in > >>upstream qemu. First, I think it shouldn''t be a separate command line > >>switch but an option for the existion -vnc switch. Second, we need a > >>way to communicate the port picked which isn''t xen-specific. Obvious > >>choice is a monitor info subcommand. > >> > >>Comments? Other suggestions? > >> > >> > > > >Presumably -vncunused is passed by the management application, which > >knows about all domains. Can''t it figure out an unused port and pass > >it on? > > An argument for this sort of semantics is that if you just launch > vncserver with no argument, it''ll sit on the first unused port. So > people are sort of used to this behavior. > > >Alternatively, have the management application pass an fd denoting the > >socket. > > If you are allocating the ports in the management tool, then just tell > QEMU what port to open up. I don''t think you gain anything passing an fd.And it as I mentioned it''ll make adding IPv6 support harder. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Anthony Liguori wrote:> >> Alternatively, have the management application pass an fd denoting >> the socket. > > If you are allocating the ports in the management tool, then just tell > QEMU what port to open up. I don''t think you gain anything passing an > fd. >It prevents races, allows listening on non-traditional sockets (vnc over unix-domain), and allows privilege separation. -- error compiling committee.c: too many arguments to function _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Anthony Liguori writes ("[Xen-devel] Re: [Qemu-devel] vnc port selection"):> Avi Kivity wrote: > > Presumably -vncunused is passed by the management application, which > > knows about all domains. Can''t it figure out an unused port and pass > > it on? > > An argument for this sort of semantics is that if you just launch > vncserver with no argument, it''ll sit on the first unused port. So > people are sort of used to this behavior.Exactly. So that''s why we need both the ability to do this, and the ability to find out what port was eventually used.> > Alternatively, have the management application pass an fd denoting the > > socket. > > If you are allocating the ports in the management tool, then just tell > QEMU what port to open up. I don''t think you gain anything passing an fd.That has a race, because you commit to the port before having prevented another application from grabbing it. I think the `pick unused port'' option is more sensible. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel