From 3be34f57925b8850e6012f36bafb9f1036bf1cc0 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 29 Jan 2009 15:51:58 +0000 Subject: [PATCH] KVM: advise about VNC support on GetShellCommand Reviewed-by: iustinp --- lib/hypervisor/hv_kvm.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index da80b4c9c..d14418588 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -621,6 +621,17 @@ class KVMHypervisor(hv_base.BaseHypervisor): utils.ShellQuote(cls._InstanceSerial(instance.name)))) else: shell_command = "echo 'No serial shell for instance %s'" % instance.name + + vnc_bind_address = hvparams[constants.HV_VNC_BIND_ADDRESS] + if vnc_bind_address: + if instance.network_port > constants.HT_HVM_VNC_BASE_PORT: + display = instance.network_port - constants.HT_HVM_VNC_BASE_PORT + vnc_command = ("echo 'Instance has VNC listening on %s:%d" + " (display: %d)'" % (vnc_bind_address, + instance.network_port, + display)) + shell_command = "%s; %s" % (vnc_command, shell_command) + return shell_command def Verify(self): -- GitLab