more information for VNC console port
authorAlexander Schreiber <als@google.com>
Fri, 22 Aug 2008 12:00:59 +0000 (12:00 +0000)
committerAlexander Schreiber <als@google.com>
Fri, 22 Aug 2008 12:00:59 +0000 (12:00 +0000)
This patch extends the gnt-instance info again. If vnc_bind_address is
set to 127.0.0.1 then the 'VNC console port' line will also print the
nodename on which to connect to localhost.

While this duplicates info from the Node:primary output, it should make
it simpler for scripts that look for VNC console port information.

Reviewed-by: ultrotter

lib/cmdlib.py

index 4ebce79..a74b75a 100644 (file)
@@ -4947,8 +4947,12 @@ class LUQueryInstanceData(NoHooksLU):
         if instance.network_port is None:
           vnc_console_port = None
         elif instance.vnc_bind_address == constants.BIND_ADDRESS_GLOBAL:
-          vnc_console_port = "%s:%s"% (instance.primary_node,
+          vnc_console_port = "%s:%s" % (instance.primary_node,
                                        instance.network_port)
+        elif instance.vnc_bind_address == constants.LOCALHOST_IP_ADDRESS:
+          vnc_console_port = "%s:%s on node %s" % (instance.vnc_bind_address,
+                                                   instance.network_port,
+                                                   instance.primary_node)
         else:
           vnc_console_port = "%s:%s" % (instance.vnc_bind_address,
                                         instance.network_port)