Commit 2e6ccd02 authored by Łukasz Nowak's avatar Łukasz Nowak

kvm: Increase default VM parameters to match nowadays requirement

KVM which defaults to 1024 RAM, 10 GB disk and 1 CPU is too small for nowadays
OS requirements, so to avoid confusions, increase the defaults.
parent 49a347ed
......@@ -43,12 +43,12 @@ KVM instance parameters:
- nbd2-port (default: 1024)
- nbd2-host
- ram-size (default: 1024)
- disk-size = (default: 10)
- ram-size (default: 4096)
- disk-size = (default: 40)
- disk-type (default: virtio)
Disk size and Disk type are used if no virtual hard drive is specified.
- cpu-count (default: 1)
- cpu-count (default: 2)
- cpu-options
cpu-option is a string: [cores=cores][,threads=threads][,sockets=sockets][,maxcpus=maxcpus]
- numa
......
......@@ -19,11 +19,11 @@ md5sum = f2b0f1ed27148504f220e06eaceff935
[template-kvm]
filename = instance-kvm.cfg.jinja2
md5sum = 78c3b69a2b18106cd6e289732116881d
md5sum = 17c58f74d1ed4cb7dce11bf9af71dd33
[template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in
md5sum = 59b92e1300aad4e9b116c532caf7d042
md5sum = fcb35c32ef985e3d69a7914711675dcc
[template-kvm-resilient]
filename = instance-kvm-resilient.cfg.jinja2
......
......@@ -225,7 +225,7 @@
"title": "RAM size",
"description": "RAM size, in MB.",
"type": "integer",
"default": 1024,
"default": 4096,
"minimum": 1024,
"multipleOf": 512
},
......@@ -233,6 +233,7 @@
"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. Defaults to ram-size + 512",
"type": "integer",
"default": 4608,
"minimum": 1024,
"multipleOf": 512
},
......@@ -254,7 +255,7 @@
"title": "Disk size",
"description": "Disk size, in GB.",
"type": "integer",
"default": 10,
"default": 40,
"minimum": 1
},
"disk-format": {
......@@ -313,6 +314,7 @@
"title": "CPU count",
"description": "Number of CPU cores.",
"type": "integer",
"default": 2,
"minimum": 1
},
"cpu-max-count": {
......
......@@ -77,14 +77,14 @@ config-authorized-key = {{ dumps(slapparameter_dict.get('authorized-keys') | joi
{% endif -%}
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', int(kvm_parameter_dict.get('ram-size', 1024)) + 512)) }}
config-ram-size = {{ dumps(kvm_parameter_dict.get('ram-size', 4096)) }}
config-ram-max-size = {{ dumps(kvm_parameter_dict.get('ram-max-size', int(kvm_parameter_dict.get('ram-size', 4096)) + 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-size = {{ dumps(kvm_parameter_dict.get('disk-size', 40)) }}
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-count = {{ dumps(kvm_parameter_dict.get('cpu-count', 2)) }}
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', '')) }}
......
......@@ -13,7 +13,7 @@
"title": "RAM size",
"description": "RAM size, in MB.",
"type": "integer",
"default": 1024,
"default": 4096,
"minimum": 1024,
"multipleOf": 512
},
......@@ -21,6 +21,7 @@
"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. Defaults to ram-size + 512",
"type": "integer",
"default": 4608,
"minimum": 1024,
"multipleOf": 512
},
......@@ -42,7 +43,7 @@
"title": "Disk size",
"description": "Disk size, in GB.",
"type": "integer",
"default": 10,
"default": 40,
"minimum": 1
},
"disk-type": {
......@@ -101,7 +102,8 @@
"title": "CPU count",
"description": "Number of CPU cores.",
"type": "integer",
"minimum": 1
"minimum": 1,
"default": 2
},
"cpu-max-count": {
"title": "Maximum CPU amount",
......
......@@ -22,8 +22,8 @@
{% set boot_image_url_list_enabled = 'boot-image-url-list' in slapparameter_dict %}
{% set boot_image_url_select_enabled = 'boot-image-url-select' in slapparameter_dict %}
{% set bootstrap_script_url = slapparameter_dict.get('bootstrap-script-url') -%}
{% 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 cpu_max_count = dumps(slapparameter_dict.get('cpu-max-count', int(slapparameter_dict.get('cpu-count', 2)) + 1)) %}
{% set ram_max_size = dumps(slapparameter_dict.get('ram-max-size', int(slapparameter_dict.get('ram-size', 4096)) + 512)) %}
{% set extends_list = [] -%}
{% set part_list = [] -%}
......@@ -441,8 +441,8 @@ socket-path = ${kvm-controller-parameter-dict:socket-path}
smp-max-count = {{ cpu_max_count }}
ram-max-size = {{ ram_max_size }}
{%- if enable_device_hotplug %}
init-ram-size = 1024
init-smp-count = 1
init-ram-size = 4096
init-smp-count = 2
{%- else %}
init-ram-size = ${kvm-controller-parameter-dict:ram-size}
init-smp-count = ${kvm-controller-parameter-dict:cpu-count}
......@@ -1068,14 +1068,14 @@ nbd2-host =
boot-image-url-list =
enable-device-hotplug = False
ram-size = 1024
ram-size = 4096
ram-hotplug-slot-size = 512
disk-size = 10
disk-size = 40
disk-type = virtio
disk-format = qcow2
disk-device-path =
cpu-count = 1
cpu-count = 2
disk-cache =
disk-aio =
auto-ballooning = True
......
......@@ -230,7 +230,7 @@ class TestMemoryManagement(InstanceTestCase, KvmMixin):
def test(self):
kvm_pid_1, info_list = self.getKvmProcessInfo(['-smp', '-m'])
self.assertEqual(
['1,maxcpus=2', '1024M,slots=128,maxmem=1536M'],
['2,maxcpus=3', '4096M,slots=128,maxmem=4608M'],
info_list
)
self.rerequestInstance({
......@@ -264,7 +264,7 @@ class TestMemoryManagement(InstanceTestCase, KvmMixin):
kvm_pid_1, info_list = self.getKvmProcessInfo(['-smp', '-m'])
self.assertEqual(
['1,maxcpus=2', '1024M,slots=128,maxmem=1536M'],
['2,maxcpus=3', '4096M,slots=128,maxmem=4608M'],
info_list
)
self.assertEqual(
......@@ -275,15 +275,15 @@ class TestMemoryManagement(InstanceTestCase, KvmMixin):
parameter_dict = {
'enable-device-hotplug': 'true',
# to avoid restarts the max RAM and CPU has to be static
'ram-max-size': '2048',
'cpu-max-count': '4',
'ram-max-size': '8192',
'cpu-max-count': '6',
}
self.rerequestInstance(parameter_dict)
self.slap.waitForInstance(max_retry=2)
kvm_pid_2, info_list = self.getKvmProcessInfo(['-smp', '-m'])
self.assertEqual(
['1,maxcpus=4', '1024M,slots=128,maxmem=2048M'],
['2,maxcpus=6', '4096M,slots=128,maxmem=8192M'],
info_list
)
self.assertEqual(
......@@ -292,21 +292,21 @@ class TestMemoryManagement(InstanceTestCase, KvmMixin):
)
self.assertNotEqual(kvm_pid_1, kvm_pid_2, "Unexpected: KVM not restarted")
parameter_dict.update(**{
'ram-size': '1536',
'cpu-count': '2'
'ram-size': '5120',
'cpu-count': '4'
})
self.rerequestInstance(parameter_dict)
self.slap.waitForInstance(max_retry=10)
kvm_pid_3, info_list = self.getKvmProcessInfo(['-smp', '-m'])
self.assertEqual(
['1,maxcpus=4', '1024M,slots=128,maxmem=2048M'],
['2,maxcpus=6', '4096M,slots=128,maxmem=8192M'],
info_list
)
self.assertEqual(kvm_pid_2, kvm_pid_3, "Unexpected: KVM restarted")
self.assertEqual(
getHotpluggedCpuRamValue(),
{'cpu_count': 1, 'ram_mb': 512}
{'cpu_count': 2, 'ram_mb': 1024}
)
......
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