
On Wed, Nov 21, 2012 at 04:37:35PM +0100, Martin Kletzander wrote:
The 'virsh domdisplay' command is able to display the password configured for spice, but it was missing for vnc type graphics. This is just a simple patch for that to work properly. --- tools/virsh-domain.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index cc47383..18aa869 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7073,6 +7073,23 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) if (STREQ(scheme[iter], "vnc")) { /* VNC protocol handlers take their port number as 'port' - 5900 */ port -= 5900; + + if (vshCommandOptBool(cmd, "include-password")) { + /* Create our XPATH lookup for the SPICE password */
s/spice/vnc/
+ virAsprintf(&xpath, + "string(/domain/devices/graphics" + "[@type='%s']/@passwd)", + scheme[iter]); + if (!xpath) { + virReportOOMError(); + goto cleanup; + } + + /* Attempt to get the SPICE password */
s/spice/vnc/
+ passwd = virXPathString(xpath, ctxt); + VIR_FREE(xpath); + } +
Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|