X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/0e16120a7b3ae7887089cd1f8fc8d1e9925ebe52..251a74f2ce55741ee63f8d5b6c732f5631912b79:/code/main.py diff --git a/code/main.py b/code/main.py index e5fdfa9..e208a13 100755 --- a/code/main.py +++ b/code/main.py @@ -196,20 +196,25 @@ def create(user, fields): def getListDict(user): """Gets the list of local variables used by list.tmpl.""" + checkpoint.checkpoint('Starting') machines = g.machines checkpoint.checkpoint('Got my machines') on = {} has_vnc = {} - on = g.uptimes + xmlist = g.xmlist checkpoint.checkpoint('Got uptimes') for m in machines: - m.uptime = g.uptimes.get(m) - if not on[m]: + if m not in xmlist: has_vnc[m] = 'Off' - elif m.type.hvm: - has_vnc[m] = True + m.uptime = None else: - has_vnc[m] = "ParaVM"+helppopup("paravm_console") + m.uptime = xmlist[m]['uptime'] + if xmlist[m]['console']: + has_vnc[m] = True + elif m.type.hvm: + has_vnc[m] = "WTF?" + else: + has_vnc[m] = "ParaVM"+helppopup("paravm_console") max_memory = validation.maxMemory(user) max_disk = validation.maxDisk(user) checkpoint.checkpoint('Got max mem/disk') @@ -227,8 +232,7 @@ def getListDict(user): max_disk=max_disk, defaults=defaults, machines=machines, - has_vnc=has_vnc, - uptimes=g.uptimes) + has_vnc=has_vnc) return d def listVms(user, fields): @@ -651,7 +655,8 @@ def main(operation, user, fields): output_string = str(output) checkpoint.checkpoint('output as a string') print output_string - print '' % checkpoint + if fields.has_key('timedebug'): + print '
%s
' % checkpoint except Exception, err: if not fields.has_key('js'): if isinstance(err, CodeError): @@ -675,6 +680,13 @@ def main(operation, user, fields): if __name__ == '__main__': fields = cgi.FieldStorage() + + if fields.has_key('sqldebug'): + import logging + logging.basicConfig() + logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) + logging.getLogger('sqlalchemy.orm.unitofwork').setLevel(logging.INFO) + u = getUser() g.user = u operation = os.environ.get('PATH_INFO', '')