On 02/16/2015 06:51 PM, Pavel Hrdina wrote:
On Sun, Feb 15, 2015 at 04:49:09PM +0800, Luyao Huang wrote:
Just like the fix for domdisplay in commit 1ba815.
---
  tools/virsh-domain.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index dc4a863..2506b89 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10269,6 +10269,18 @@ cmdVNCDisplay(vshControl *ctl, const vshCmd *cmd)
listen_addr = virXPathString("string(/domain/devices/graphics"
                                   "[@type='vnc']/@listen)", ctxt);
+    if (!listen_addr) {
+        /* The subelement address - <listen address='xyz'/> -
+         * *should* have been automatically backfilled into its
+         * parent <graphics listen='xyz'> (which we just tried to
+         * retrieve into listen_addr above) but in some cases it
+         * isn't, so we also do an explicit check for the
+         * subelement (which, by the way, doesn't exist on libvirt
+         * < 0.9.4, so we really do need to check both places)
+         */
+        listen_addr = virXPathString("string(/domain/devices/graphics"
+                                     "[@type='vnc']/listen/@address)", ctxt);
+    }
      if (listen_addr == NULL || STREQ(listen_addr, "0.0.0.0"))
          vshPrint(ctl, ":%d\n", port-5900);
      else
--
1.8.3.1

ACK and pushed.

Thanks for the quick review.
Pavel

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to