1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

view instance: check_user_quota is not performed for superuser

This commit is contained in:
Ing. Jan KRCMAR 2018-09-06 14:26:29 +02:00
parent 6486c20168
commit 105b8c180a

View file

@ -274,6 +274,12 @@ def instance(request, compute_id, vname):
return free_names return free_names
def check_user_quota(instance, cpu, memory, disk_size): def check_user_quota(instance, cpu, memory, disk_size):
ua = request.user.userattributes
msg = ""
if request.user.is_superuser:
return msg
user_instances = UserInstance.objects.filter(user_id=request.user.id, instance__is_template=False) user_instances = UserInstance.objects.filter(user_id=request.user.id, instance__is_template=False)
instance += user_instances.count() instance += user_instances.count()
for usr_inst in user_instances: for usr_inst in user_instances:
@ -290,8 +296,6 @@ def instance(request, compute_id, vname):
if disk['size']: if disk['size']:
disk_size += int(disk['size'])>>30 disk_size += int(disk['size'])>>30
ua = request.user.userattributes
msg = ""
if ua.max_instances > 0 and instance > ua.max_instances: if ua.max_instances > 0 and instance > ua.max_instances:
msg = "instance" msg = "instance"
if settings.QUOTA_DEBUG: if settings.QUOTA_DEBUG: