projects
/
invirt/packages/invirt-web.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use joins, new xmlist.py
[invirt/packages/invirt-web.git]
/
code
/
main.py
diff --git
a/code/main.py
b/code/main.py
index
e5fdfa9
..
e208a13
100755
(executable)
--- 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."""
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 = {}
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:
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'
has_vnc[m] = 'Off'
- elif m.type.hvm:
- has_vnc[m] = True
+ m.uptime = None
else:
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')
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,
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):
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
output_string = str(output)
checkpoint.checkpoint('output as a string')
print output_string
- print '<!-- <pre>%s</pre> -->' % checkpoint
+ if fields.has_key('timedebug'):
+ print '<pre>%s</pre>' % checkpoint
except Exception, err:
if not fields.has_key('js'):
if isinstance(err, CodeError):
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 __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', '')
u = getUser()
g.user = u
operation = os.environ.get('PATH_INFO', '')