[libvirt] [PATCH] virsh: Add domdisplay command for VNC and SPICE

Michal Privoznik mprivozn at redhat.com
Fri Jun 22 08:19:06 UTC 2012


On 22.06.2012 07:38, Doug Goldstein wrote:
> On Fri, Jun 22, 2012 at 12:30 AM, Doug Goldstein <cardoe at cardoe.com> wrote:
>> Add a new 'domdisplay' command that provides a URI for both VNC and
>> SPICE connections. Presently the 'vncdisplay' command provides you with
>> the port info that QEMU is listening on but there is no counterpart for
>> SPICE. Additionally this provides you with the bind address as specified
>> in the XML, which the existing 'vncdisplay' lacks.
>>
> 
> I also toyed with the idea of adding this instead as an API call to
> libvirt called something like virDomainDisplay() and allowing other
> backends to advertise their URIs to the domain's display. I believe
> VMWare has VMWare View which I would assume would have a method by
> which to call it and provide the machine to connect to as command line
> arguments. Then virsh would simply hook the 'domdisplay' command to
> virDomainDisplay() and spit out that output. It would probably be able
> to be used by virt-manager and vdsm as well.
> 
> Just a thought. Let me know.
> 

Yeah, that's what I was thinking of when reading your patch. I think we
can add a new API that would return all info needed to connect to a
display. I think it could look like this:

char * virDomainGetGraphicsInfo(virDomainPtr dom,
                                unsigned int flags);

It would return a XML doc containing all interesting knobs:

<graphics type='spice' port='5904'>
  <listen type='address' address='1.2.3.4'/>
  <channel name='main' mode='secure'/>
  <channel name='record' mode='insecure'/>
  <image compression='auto_glz'/>
  <streaming mode='filter'/>
  <clipboard copypaste='no'/>
  <mouse mode='client'/>
</graphics>

yeah it's basically copy&paste-d from domain's XML, but there is huge
difference. Currently vncdisplay command (and from quick look at your
patch domdisplay too) don't show correct listen address if none set in
domain's XML. Because in that case we take the one from qemu.conf.
However, this cannot be stored into domain's XML as it would discard all
future changes to vnc_listen|spice_listen in qemu.conf. For instance,
user doesn't set any listenAddress in domain's XML but set
vnc_listen=1.2.3.4; Then we want vncdisplay (and subsequently
domdisplay) to return 1.2.3.4:<port>
Moreover, it's the daemon only who know what has been set in config files.

Summing up, I think we need a new API which would take into account all
written above. And to make our lives easier it can return an XML with
RNG taken from domain XML (docs/schemas/domaincommon.rng); And since
there may be security info we can use VIR_GRAPHICS_XML_SECURE flag to
show it or not.

Michal




More information about the libvir-list mailing list