From: Geoffrey Thomas Date: Thu, 31 Jul 2008 02:16:51 +0000 (-0400) Subject: VNC: Catch the error when the VM is off and there is no host X-Git-Tag: sipb-xen-www/3.6~4 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/d451a23080ee049682d51409b4bf93c9a30a1a71 VNC: Catch the error when the VM is off and there is no host svn path=/trunk/packages/sipb-xen-www/; revision=797 --- diff --git a/code/main.py b/code/main.py index 4627c66..7af4ecc 100755 --- a/code/main.py +++ b/code/main.py @@ -257,8 +257,12 @@ def vnc(username, state, path, fields): token = {'data': pickled_data, 'digest': m.digest()} token = cPickle.dumps(token) token = base64.urlsafe_b64encode(token) - port = 10003 + [config_host["hostname"] for config_host in invirt_config["hosts"] - ].index(controls.listHost(machine)) + host = controls.listHost(machine) + if host: + port = 10003 + [config_host["hostname"] for config_host in invirt_config["hosts"] + ].index(controls.listHost(machine)) + else: + port = 5900 # dummy status = controls.statusInfo(machine) has_vnc = hasVnc(status)