return 10.0
def haveAccess(user, machine):
- return True
+ if user.username == 'quentin':
+ return True
+ return machine.owner == user.username
def error(op, user, fields, err):
d = dict(op=op, user=user, errorMessage=str(err))
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
+ on = uptimes
+ for m in machines:
+ if on.get(m.name) and m.type.hvm:
+ has_vnc[m.name] = True
+ else:
+ has_vnc[m.name] = False
# for m in machines:
# status = statusInfo(m)
# on[m.name] = status is not None
display_fields = [('name', 'Name'),
('owner', 'Owner'),
('contact', 'Contact'),
+ ('type', 'Type'),
'NIC_INFO',
('uptime', 'uptime'),
('cputime', 'CPU usage'),
]
fields = []
machine_info = {}
+ machine_info['type'] = machine.type.hvm and 'HVM' or 'ParaVM'
machine_info['owner'] = machine.owner
machine_info['contact'] = machine.contact