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
ParaVM on list
[invirt/packages/invirt-web.git]
/
templates
/
main.py
diff --git
a/templates/main.py
b/templates/main.py
index
36518d6
..
4a50e43
100755
(executable)
--- a/
templates/main.py
+++ b/
templates/main.py
@@
-41,7
+41,9
@@
def maxDisk(user, machine=None):
return 10.0
def haveAccess(user, machine):
return 10.0
def haveAccess(user, machine):
- return True
+ if user.username == 'moo':
+ return True
+ return machine.owner == user.username
def error(op, user, fields, err):
d = dict(op=op, user=user, errorMessage=str(err))
def error(op, user, fields, err):
d = dict(op=op, user=user, errorMessage=str(err))
@@
-268,11
+270,19
@@
def create(user, fields):
searchList=d);
def listVms(user, fields):
searchList=d);
def listVms(user, fields):
- machines = Machine.select()
+ machines = [m for m in Machine.select() if haveAccess(user, m)]
on = {}
has_vnc = {}
uptimes = getUptimes(machines)
on = {}
has_vnc = {}
uptimes = getUptimes(machines)
- on = has_vnc = uptimes
+ on = uptimes
+ for m in machines:
+ if not on.get(m.name):
+ has_vnc[m.name] = 'Off'
+ elif m.type.hvm:
+ has_vnc[m.name] = True
+ else:
+ help_name = 'paravm_console'
+ has_vnc[m.name] = 'ParaVM <span class="helplink"><a href="help?subject=%s&simple=true" target="_blank" onclick="return helppopup(\'%s\')">(?)</a></span>' % (help_name, help_name)
# for m in machines:
# status = statusInfo(m)
# on[m.name] = status is not None
# for m in machines:
# status = statusInfo(m)
# on[m.name] = status is not None
@@
-434,6
+444,7
@@
def info(user, fields):
display_fields = [('name', 'Name'),
('owner', 'Owner'),
('contact', 'Contact'),
display_fields = [('name', 'Name'),
('owner', 'Owner'),
('contact', 'Contact'),
+ ('type', 'Type'),
'NIC_INFO',
('uptime', 'uptime'),
('cputime', 'CPU usage'),
'NIC_INFO',
('uptime', 'uptime'),
('cputime', 'CPU usage'),
@@
-450,6
+461,7
@@
def info(user, fields):
]
fields = []
machine_info = {}
]
fields = []
machine_info = {}
+ machine_info['type'] = machine.type.hvm and 'HVM' or 'ParaVM'
machine_info['owner'] = machine.owner
machine_info['contact'] = machine.contact
machine_info['owner'] = machine.owner
machine_info['contact'] = machine.contact