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 */
+ virAsprintf(&xpath,
+ "string(/domain/devices/graphics"
+ "[@type='%s']/@passwd)",
+ scheme[iter]);
+ if (!xpath) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ /* Attempt to get the SPICE password */
+ passwd = virXPathString(xpath, ctxt);
+ VIR_FREE(xpath);
+ }
+
} else if (STREQ(scheme[iter], "spice")) {
/* Create our XPATH lookup for the SPICE TLS Port */
virAsprintf(&xpath,
"string(/domain/devices/graphics[@type='%s']"
--
1.8.0