mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 15:15:22 +00:00
view instance: check_user_quota is not performed for superuser
This commit is contained in:
parent
6486c20168
commit
105b8c180a
1 changed files with 6 additions and 2 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue