Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cbdce68f
authored
Feb 01, 2021
by
Máhonfai Bálint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also check group limits when creating VMs
parent
f2d34c8e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
circle/dashboard/views/vm.py
+18
-4
No files found.
circle/dashboard/views/vm.py
View file @
cbdce68f
...
@@ -1035,8 +1035,10 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
...
@@ -1035,8 +1035,10 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
except
ValueError
:
except
ValueError
:
messages
.
error
(
self
.
request
,
_
(
"Error during filtering."
))
messages
.
error
(
self
.
request
,
_
(
"Error during filtering."
))
return
queryset
.
prefetch_related
(
"owner"
,
"node"
,
"owner__profile"
,
"lease"
,
return
queryset
.
prefetch_related
(
"interface_set"
,
"interface_set__host"
,
"template"
)
.
distinct
()
"owner"
,
"node"
,
"owner__profile"
,
"lease"
,
"interface_set"
,
"interface_set__host"
,
"template"
)
.
distinct
()
class
VmCreate
(
LoginRequiredMixin
,
TemplateView
):
class
VmCreate
(
LoginRequiredMixin
,
TemplateView
):
...
@@ -1170,8 +1172,20 @@ class VmCreate(LoginRequiredMixin, TemplateView):
...
@@ -1170,8 +1172,20 @@ class VmCreate(LoginRequiredMixin, TemplateView):
# limit chekcs
# limit chekcs
try
:
try
:
instance_limit
=
user
.
profile
.
instance_limit
instance_limits
=
[
user
.
profile
.
instance_limit
]
template_instance_limit
=
user
.
profile
.
template_instance_limit
instance_limits
+=
[
group
.
profile
.
instance_limit
for
group
in
user
.
groups
.
all
()
]
template_instance_limits
=
[
user
.
profile
.
template_instance_limit
]
template_instance_limits
+=
[
group
.
profile
.
template_instance_limit
for
group
in
user
.
groups
.
all
()
]
instance_limit
=
max
(
instance_limits
)
template_instance_limit
=
max
(
template_instance_limits
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
debug
(
'No profile or instance limit:
%
s'
,
e
)
logger
.
debug
(
'No profile or instance limit:
%
s'
,
e
)
else
:
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment