]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: Fix domdisplay when domain only uses TLS
authorChristophe Fergeau <cfergeau@redhat.com>
Wed, 25 Sep 2013 15:48:01 +0000 (17:48 +0200)
committerChristophe Fergeau <cfergeau@redhat.com>
Fri, 27 Sep 2013 15:40:11 +0000 (17:40 +0200)
commit9976c4b9a665f10ab0d2071954efb7f432d194eb
treeb07aecb2be6e0fe00693306d76c63a4c7d566671
parent9e03f313b80d6b7daef90235b607e7ed80dd7235
virsh: Fix domdisplay when domain only uses TLS

It's possible to create a domain which will only use a TLS port
and will not have a non-TLS port set by using:
<graphics type='spice' autoport='yes' defaultMode='secure'/>
In such a setup, the 'graphics' node for the running domain will be:
<graphics type='spice' tlsPort='5900'
          autoport='yes' listen='127.0.0.1'
          defaultMode='secure'>

However, cmdDomDisplay loops over all the 'graphics' node, and it
ignores nodes which don't have a 'port' attribute. This means
'virsh domdisplay' will only return an empty string for domains
as the one above.

This commit looks for both 'port' and 'tlsPort' before deciding
to ignore a graphics node. It also makes sure 'port' is not printed
when it's not set.
This makes 'virsh domdisplay' return
'spice://127.0.0.1?tls-port=5900' for domains using only a TLS
port.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
tools/virsh-domain.c