Commit 8d781fe7 authored by Łukasz Nowak's avatar Łukasz Nowak

software/kvm: Set cpu-max-count and ram-max-size defaults correctly

As cpu-count and ram-size can be setup freely by the user, the cpu-max-count
and ram-max-size shall follow it.

Otherwise it generates hard to track issues with starting VMs.
parent 119f7299
Pipeline #10925 passed with stage
in 0 seconds
......@@ -19,11 +19,11 @@ md5sum = b36b6b3ccb15758d99f3b6258b141db9
[template-kvm]
filename = instance-kvm.cfg.jinja2
md5sum = fb4d76a83ff7c2d0f205d52fb314a9ee
md5sum = 7ee760b2146ae38099fb1e35acf758c1
[template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in
md5sum = 73b09e75d617888f6d84d363c0ada9c5
md5sum = ade6c2032578cc19df4f7487aafe8d9c
[template-kvm-resilient]
filename = instance-kvm-resilient.cfg.jinja2
......
......@@ -231,9 +231,8 @@
},
"ram-max-size": {
"title": "Maximum RAM size, in MB",
"description": "Define the maximum size of the memory. The size is in MB and should be a multiple of 512.",
"description": "Define the maximum size of the memory. The size is in MB and should be a multiple of 512. Defaults to ram-size + 512",
"type": "integer",
"default": 51200,
"minimum": 1024,
"multipleOf": 512
},
......@@ -318,9 +317,8 @@
},
"cpu-max-count": {
"title": "Maximum CPU amount",
"description": "Specifies the maximum number of CPUs.",
"description": "Specifies the maximum number of CPUs. Defaults to cpu-count + 1",
"type": "integer",
"default": 24,
"minimum": 1
},
"numa": {
......
......@@ -74,14 +74,14 @@ config-authorized-key = {{ dumps(slapparameter_dict.get('authorized-keys') | joi
config-nbd-port = {{ dumps(kvm_parameter_dict.get('nbd-port', 1024)) }}
config-nbd2-port = {{ dumps(kvm_parameter_dict.get('nbd-port2', 1024)) }}
config-ram-size = {{ dumps(kvm_parameter_dict.get('ram-size', 1024)) }}
config-ram-max-size = {{ dumps(kvm_parameter_dict.get('ram-max-size', '51200')) }}
config-ram-max-size = {{ dumps(kvm_parameter_dict.get('ram-max-size', int(kvm_parameter_dict.get('ram-size', 1024)) + 512)) }}
config-enable-device-hotplug = {{ dumps(kvm_parameter_dict.get('enable-device-hotplug', False)) }}
config-ram-hotplug-slot-size = {{ dumps(kvm_parameter_dict.get('ram-hotplug-slot-size', 512)) }}
config-disk-size = {{ dumps(kvm_parameter_dict.get('disk-size', 10)) }}
config-disk-type = {{ dumps(kvm_parameter_dict.get('disk-type', 'virtio')) }}
config-disk-format = {{ dumps(kvm_parameter_dict.get('disk-format', 'qcow2')) }}
config-cpu-count = {{ dumps(kvm_parameter_dict.get('cpu-count', 1)) }}
config-cpu-max-count = {{ dumps(kvm_parameter_dict.get('cpu-max-count', 24)) }}
config-cpu-max-count = {{ dumps(kvm_parameter_dict.get('cpu-max-count', int(kvm_parameter_dict.get('cpu-count', 1)) + 1)) }}
{{ setconfig('numa', kvm_parameter_dict.get('numa', '')) }}
{{ setconfig('machine-options', kvm_parameter_dict.get('machine-options', '')) }}
{{ setconfig('nbd-host', kvm_parameter_dict.get('nbd-host', '')) }}
......
......@@ -19,9 +19,8 @@
},
"ram-max-size": {
"title": "Maximum RAM size, in MB",
"description": "Define the maximum size of the memory. The size is in MB and should be a multiple of 512.",
"description": "Define the maximum size of the memory. The size is in MB and should be a multiple of 512. Defaults to ram-size + 512",
"type": "integer",
"default": 51200,
"minimum": 1024,
"multipleOf": 512
},
......@@ -106,9 +105,8 @@
},
"cpu-max-count": {
"title": "Maximum CPU amount",
"description": "Specifies the maximum number of CPUs.",
"description": "Specifies the maximum number of CPUs. Defaults to cpu-count + 1",
"type": "integer",
"default": 24,
"minimum": 1
},
"numa": {
......
......@@ -9,6 +9,8 @@
{% set instance_type = slapparameter_dict.get('type', 'standalone') -%}
{% set nat_rule_list = slapparameter_dict.get('nat-rules', '22 80 443') -%}
{% set disk_device_path = slapparameter_dict.get('disk-device-path', None) -%}
{% set cpu_max_count = dumps(slapparameter_dict.get('cpu-max-count', int(slapparameter_dict.get('cpu-count', 1)) + 1)) %}
{% set ram_max_size = dumps(slapparameter_dict.get('ram-max-size', int(slapparameter_dict.get('ram-size', 1024)) + 512)) %}
{% set extends_list = [] -%}
{% set part_list = [] -%}
......@@ -104,10 +106,10 @@ socket-path = ${kvm-controller-parameter-dict:socket-path}
enable-device-hotplug = ${kvm-controller-parameter-dict:enable-device-hotplug}
smp-count = ${kvm-controller-parameter-dict:cpu-count}
smp-max-count = ${slap-parameter:cpu-max-count}
smp-max-count = {{ cpu_max_count }}
ram-size = ${kvm-controller-parameter-dict:ram-size}
ram-max-size = ${slap-parameter:ram-max-size}
ram-max-size = {{ ram_max_size }}
init-ram-size = 1024
mac-address = ${create-mac:mac-address}
tap-mac-address = ${create-tap-mac:mac-address}
......@@ -711,7 +713,6 @@ nbd2-host =
enable-device-hotplug = False
ram-size = 1024
ram-max-size = 51200
ram-hotplug-slot-size = 512
disk-size = 10
disk-type = virtio
......@@ -719,7 +720,6 @@ disk-format = qcow2
disk-device-path =
cpu-count = 1
cpu-max-count = 24
disk-cache = writeback
disk-aio = native
auto-ballooning = 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 to comment