Commit c81dca43 by Chif Gergő

Virtual CPU core max value now configurable

Add new environment variable (MAX_NODE_CPU_RAM) in settings/base.py. Using this variable in dashboard/forms.py as maximal value of cpu cores.
parent aa92a44d
Pipeline #657 passed with stage
in 0 seconds
...@@ -574,6 +574,7 @@ SESSION_COOKIE_NAME = "csessid%x" % (((getnode() // 139) ^ ...@@ -574,6 +574,7 @@ SESSION_COOKIE_NAME = "csessid%x" % (((getnode() // 139) ^
(getnode() % 983)) & 0xffff) (getnode() % 983)) & 0xffff)
MAX_NODE_RAM = get_env_variable("MAX_NODE_RAM", 1024) MAX_NODE_RAM = get_env_variable("MAX_NODE_RAM", 1024)
MAX_NODE_CPU_CORE = get_env_variable("MAX_NODE_CPU_CORE", 10)
# Url to download the client: (e.g. http://circlecloud.org/client/download/) # Url to download the client: (e.g. http://circlecloud.org/client/download/)
CLIENT_DOWNLOAD_URL = get_env_variable('CLIENT_DOWNLOAD_URL', 'http://circlecloud.org/client/download/') CLIENT_DOWNLOAD_URL = get_env_variable('CLIENT_DOWNLOAD_URL', 'http://circlecloud.org/client/download/')
......
...@@ -59,7 +59,7 @@ from storage.models import DataStore, Disk ...@@ -59,7 +59,7 @@ from storage.models import DataStore, Disk
from django.contrib.admin.widgets import FilteredSelectMultiple from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from .models import Profile, GroupProfile, Message from .models import Profile, GroupProfile, Message
from circle.settings.base import LANGUAGES, MAX_NODE_RAM from circle.settings.base import LANGUAGES, MAX_NODE_RAM, MAX_NODE_CPU_CORE
from django.utils.translation import string_concat from django.utils.translation import string_concat
from .validators import domain_validator from .validators import domain_validator
...@@ -118,10 +118,10 @@ class VmCustomizeForm(forms.Form): ...@@ -118,10 +118,10 @@ class VmCustomizeForm(forms.Form):
cpu_count = forms.IntegerField(widget=forms.NumberInput(attrs={ cpu_count = forms.IntegerField(widget=forms.NumberInput(attrs={
'class': "form-control input-tags cpu-count-input", 'class': "form-control input-tags cpu-count-input",
'min': 1, 'min': 1,
'max': 10, 'max': MAX_NODE_CPU_CORE,
'required': "", 'required': "",
}), }),
min_value=1, max_value=10, min_value=1, max_value=MAX_NODE_CPU_CORE,
) )
ram_size = forms.IntegerField(widget=forms.TextInput(attrs={ ram_size = forms.IntegerField(widget=forms.TextInput(attrs={
...@@ -466,10 +466,10 @@ class TemplateForm(forms.ModelForm): ...@@ -466,10 +466,10 @@ class TemplateForm(forms.ModelForm):
num_cores = forms.IntegerField(widget=forms.NumberInput(attrs={ num_cores = forms.IntegerField(widget=forms.NumberInput(attrs={
'class': "form-control input-tags cpu-count-input", 'class': "form-control input-tags cpu-count-input",
'min': 1, 'min': 1,
'max': 10, 'max': MAX_NODE_CPU_CORE,
'required': "", 'required': "",
}), }),
min_value=1, max_value=10, min_value=1, max_value=MAX_NODE_CPU_CORE,
) )
ram_size = forms.IntegerField(widget=forms.NumberInput(attrs={ ram_size = forms.IntegerField(widget=forms.NumberInput(attrs={
...@@ -1508,10 +1508,10 @@ class VmResourcesForm(forms.ModelForm): ...@@ -1508,10 +1508,10 @@ class VmResourcesForm(forms.ModelForm):
num_cores = forms.IntegerField(widget=forms.NumberInput(attrs={ num_cores = forms.IntegerField(widget=forms.NumberInput(attrs={
'class': "form-control input-tags cpu-count-input", 'class': "form-control input-tags cpu-count-input",
'min': 1, 'min': 1,
'max': 10, 'max': MAX_NODE_CPU_CORE,
'required': "", 'required': "",
}), }),
min_value=1, max_value=10, min_value=1, max_value=MAX_NODE_CPU_CORE,
) )
ram_size = forms.IntegerField(widget=forms.NumberInput(attrs={ ram_size = forms.IntegerField(widget=forms.NumberInput(attrs={
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<i class="fa fa-ticket"></i> {% trans "RAM amount" %} <i class="fa fa-ticket"></i> {% trans "RAM amount" %}
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="vm-slider ram-slider" <input type="text" class="vm-slider ram-slider"
disabled placeholder="{% trans "Enable JS for fancy sliders" %}" disabled placeholder="{% trans "Enable JS for fancy sliders" %}"
data-slider="true" data-slider-highlight="true" data-slider-range="0, 8192" data-slider="true" data-slider-highlight="true" data-slider-range="0, 8192"
data-slider-step="128" data-slider-snap="true"/> data-slider-step="128" data-slider-snap="true"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment