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