Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
5
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
20af2315
authored
Dec 29, 2022
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update view and forms
parent
f056e0a0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
7 deletions
+15
-7
circle/dashboard/forms.py
+1
-0
circle/dashboard/templates/dashboard/template-edit.html
+1
-0
circle/vm/models/common.py
+3
-3
circle/vm/operations.py
+10
-4
No files found.
circle/dashboard/forms.py
View file @
20af2315
...
...
@@ -643,6 +643,7 @@ class TemplateForm(forms.ModelForm):
widgets
=
{
'system'
:
forms
.
TextInput
,
'max_ram_size'
:
forms
.
HiddenInput
,
'num_cores_max'
:
forms
.
HiddenInput
,
'parent'
:
forms
.
Select
(
attrs
=
{
'disabled'
:
""
}),
}
...
...
circle/dashboard/templates/dashboard/template-edit.html
View file @
20af2315
...
...
@@ -40,6 +40,7 @@
<legend>
{% trans "Resource configuration" %}
</legend>
{% include "dashboard/_resources-sliders.html" with field_priority=form.priority field_num_cores=form.num_cores field_ram_size=form.ram_size %}
{{ form.max_ram_size|as_crispy_field }}
{{ form.num_cores_max|as_crispy_field }}
</fieldset>
<fieldset>
...
...
circle/vm/models/common.py
View file @
20af2315
...
...
@@ -49,16 +49,16 @@ class BaseResourceConfigModel(Model):
help_text
=
_
(
'Number of virtual CPU cores '
'available to the virtual machine.'
),
validators
=
[
MinValueValidator
(
0
)])
num_cores_max
=
IntegerField
(
verbose_name
=
_
(
'number of cores'
),
num_cores_max
=
IntegerField
(
verbose_name
=
_
(
'number of
max
cores'
),
help_text
=
_
(
'Number of max virtual CPU cores '
'available to the virtual machine.'
),
'available to the virtual machine
(for hotplug)
.'
),
validators
=
[
MinValueValidator
(
0
)],
default
=
0
)
ram_size
=
IntegerField
(
verbose_name
=
_
(
'RAM size'
),
help_text
=
_
(
'Mebibytes of memory.'
),
validators
=
[
MinValueValidator
(
0
)])
max_ram_size
=
IntegerField
(
verbose_name
=
_
(
'maximal RAM size'
),
help_text
=
_
(
'Upper memory size limit '
'for balloning.'
),
'for balloning
(or hotplug)
.'
),
validators
=
[
MinValueValidator
(
0
)])
arch
=
CharField
(
max_length
=
10
,
verbose_name
=
_
(
'architecture'
),
choices
=
ARCHITECTURES
)
...
...
circle/vm/operations.py
View file @
20af2315
...
...
@@ -1462,13 +1462,16 @@ class HotPlugMem(RemoteInstanceOperation):
name
=
_
(
"hotplug_mem"
)
description
=
_
(
""
)
acl_level
=
"owner"
required_perms
=
()
required_perms
=
(
'vm.change_resources'
,
)
accept_states
=
(
'RUNNING'
,)
task
=
vm_tasks
.
hotplug_memset
def
_get_remote_args
(
self
,
**
kwargs
):
return
(
super
(
HotPlugMem
,
self
)
.
_get_remote_args
(
**
kwargs
)
+
[
kwargs
[
"memory"
]]
)
def
_operation
(
self
,
**
kwargs
):
super
()
.
_operation
(
**
kwargs
)
return
create_readable
(
ugettext_noop
(
"Hotplug memory: set to
%(mem)
sKb"
),
mem
=
kwargs
[
"memory"
])
@register_operation
class
HotPlugVCPU
(
RemoteInstanceOperation
):
...
...
@@ -1476,13 +1479,17 @@ class HotPlugVCPU(RemoteInstanceOperation):
name
=
_
(
"hotplug_vcpu"
)
description
=
_
(
""
)
acl_level
=
"owner"
required_perms
=
()
required_perms
=
(
'vm.change_resources'
,
)
accept_states
=
(
'RUNNING'
,)
task
=
vm_tasks
.
hotplug_vcpuset
def
_get_remote_args
(
self
,
**
kwargs
):
return
(
super
(
HotPlugVCPU
,
self
)
.
_get_remote_args
(
**
kwargs
)
+
[
kwargs
[
"vcpu"
]]
)
def
_operation
(
self
,
**
kwargs
):
super
()
.
_operation
(
**
kwargs
)
return
create_readable
(
ugettext_noop
(
"Hotplug vcpu: set to
%(vcpu)
s"
),
vcpu
=
kwargs
[
"vcpu"
])
@register_operation
class
RecoverOperation
(
InstanceOperation
):
...
...
@@ -1576,7 +1583,7 @@ class ResourcesOperation(InstanceOperation):
accept_states
=
(
'STOPPED'
,
'PENDING'
,
'RUNNING'
)
def
_operation
(
self
,
user
,
activity
,
num_cores
,
ram_size
,
max_ram_size
,
priority
,
num_cores
,
ram_size
,
priority
,
with_shutdown
=
False
,
task
=
None
):
if
self
.
instance
.
status
==
'RUNNING'
and
not
with_shutdown
:
raise
Instance
.
WrongStateError
(
self
.
instance
)
...
...
@@ -1590,7 +1597,6 @@ class ResourcesOperation(InstanceOperation):
self
.
instance
.
num_cores
=
num_cores
self
.
instance
.
ram_size
=
ram_size
self
.
instance
.
max_ram_size
=
max_ram_size
self
.
instance
.
priority
=
priority
self
.
instance
.
full_clean
()
...
...
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