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
4 years ago
by
Máhonfai Bálint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also check group limits when creating VMs
parent
f2d34c8e
Hide 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):
except
ValueError
:
messages
.
error
(
self
.
request
,
_
(
"Error during filtering."
))
return
queryset
.
prefetch_related
(
"owner"
,
"node"
,
"owner__profile"
,
"lease"
,
"interface_set"
,
"interface_set__host"
,
"template"
)
.
distinct
()
return
queryset
.
prefetch_related
(
"owner"
,
"node"
,
"owner__profile"
,
"lease"
,
"interface_set"
,
"interface_set__host"
,
"template"
)
.
distinct
()
class
VmCreate
(
LoginRequiredMixin
,
TemplateView
):
...
...
@@ -1170,8 +1172,20 @@ class VmCreate(LoginRequiredMixin, TemplateView):
# limit chekcs
try
:
instance_limit
=
user
.
profile
.
instance_limit
template_instance_limit
=
user
.
profile
.
template_instance_limit
instance_limits
=
[
user
.
profile
.
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
:
logger
.
debug
(
'No profile or instance limit:
%
s'
,
e
)
else
:
...
...
This diff is collapsed.
Click to expand it.
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