X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/6f40e43928af6296ee3058445b00eda37c9323b8..2b4e872eda2ebc5724caba7a33d05c964ae2751e:/code/main.py diff --git a/code/main.py b/code/main.py index 9d39df6..24254c7 100755 --- a/code/main.py +++ b/code/main.py @@ -11,6 +11,7 @@ import simplejson import sys import time import urllib +import random from StringIO import StringIO def revertStandardError(): @@ -254,6 +255,10 @@ def vnc(username, state, path, fields): token = {'data': pickled_data, 'digest': m.digest()} token = cPickle.dumps(token) token = base64.urlsafe_b64encode(token) + if controls.listHost(machine) == 'sx-blade-2.mit.edu': + port = 10004 + else: + port = 10003 status = controls.statusInfo(machine) has_vnc = hasVnc(status) @@ -263,6 +268,7 @@ def vnc(username, state, path, fields): has_vnc=has_vnc, machine=machine, hostname=state.environ.get('SERVER_NAME', 'localhost'), + port=port, authtoken=token) return templates.vnc(searchList=[d]) @@ -490,6 +496,7 @@ def infoDict(username, state, machine): cputime = None else: main_status = dict(status[1:]) + main_status['host'] = controls.listHost(machine) start_time = float(main_status.get('start_time', 0)) uptime = datetime.timedelta(seconds=int(time.time()-start_time)) cpu_time_float = float(main_status.get('cpu_time', 0)) @@ -506,6 +513,7 @@ def infoDict(username, state, machine): 'NIC_INFO', ('uptime', 'uptime'), ('cputime', 'CPU usage'), + ('host', 'Hosted on'), ('memory', 'RAM'), 'DISK_INFO', ('state', 'state (xen format)'), @@ -663,6 +671,8 @@ class App: self.state = State(self.username) self.state.environ = environ + random.seed() #sigh + def __iter__(self): start_time = time.time() sipb_xen_database.clear_cache()