Add configuration for cpu model flags
Change-Id: Ia26d0f2d4f540dd5b35743d0348aa6e2b8ab1954 Closes-Bug: #1750829
This commit is contained in:
parent
c744e05234
commit
1700603b0d
|
@ -259,6 +259,11 @@ options:
|
||||||
Set to a named libvirt CPU model (see names listed in
|
Set to a named libvirt CPU model (see names listed in
|
||||||
/usr/share/libvirt/cpu_map.xml). Only has effect if cpu_mode='custom' and
|
/usr/share/libvirt/cpu_map.xml). Only has effect if cpu_mode='custom' and
|
||||||
virt_type='kvm|qemu'.
|
virt_type='kvm|qemu'.
|
||||||
|
cpu-model-extra-flags:
|
||||||
|
type: string
|
||||||
|
default:
|
||||||
|
description: |
|
||||||
|
Space delimited list of specific CPU flags for libvirt.
|
||||||
# Storage config
|
# Storage config
|
||||||
libvirt-image-backend:
|
libvirt-image-backend:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
@ -210,6 +210,10 @@ class NovaComputeLibvirtContext(context.OSContextGenerator):
|
||||||
if config('cpu-model'):
|
if config('cpu-model'):
|
||||||
ctxt['cpu_model'] = config('cpu-model')
|
ctxt['cpu_model'] = config('cpu-model')
|
||||||
|
|
||||||
|
if config('cpu-model-extra-flags'):
|
||||||
|
ctxt['cpu_model_extra_flags'] = ', '.join(
|
||||||
|
config('cpu-model-extra-flags').split(' '))
|
||||||
|
|
||||||
if config('hugepages'):
|
if config('hugepages'):
|
||||||
ctxt['hugepages'] = True
|
ctxt['hugepages'] = True
|
||||||
ctxt['kvm_hugepages'] = 1
|
ctxt['kvm_hugepages'] = 1
|
||||||
|
|
|
@ -184,6 +184,9 @@ cpu_mode = {{ cpu_mode }}
|
||||||
{% if cpu_model -%}
|
{% if cpu_model -%}
|
||||||
cpu_model = {{ cpu_model }}
|
cpu_model = {{ cpu_model }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
{% if cpu_model_extra_flags %}
|
||||||
|
cpu_model_extra_flags = {{ cpu_model_extra_flags }}
|
||||||
|
{% endif %}
|
||||||
{% if libvirt_images_type -%}
|
{% if libvirt_images_type -%}
|
||||||
images_type = {{ libvirt_images_type }}
|
images_type = {{ libvirt_images_type }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
|
@ -187,6 +187,9 @@ cpu_mode = {{ cpu_mode }}
|
||||||
{% if cpu_model -%}
|
{% if cpu_model -%}
|
||||||
cpu_model = {{ cpu_model }}
|
cpu_model = {{ cpu_model }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
{% if cpu_model_extra_flags %}
|
||||||
|
cpu_model_extra_flags = {{ cpu_model_extra_flags }}
|
||||||
|
{% endif %}
|
||||||
{% if libvirt_images_type -%}
|
{% if libvirt_images_type -%}
|
||||||
images_type = {{ libvirt_images_type }}
|
images_type = {{ libvirt_images_type }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
|
@ -501,6 +501,14 @@ class NovaComputeContextTests(CharmTestCase):
|
||||||
self.assertEqual(context.nova_metadata_requirement(),
|
self.assertEqual(context.nova_metadata_requirement(),
|
||||||
(True, None))
|
(True, None))
|
||||||
|
|
||||||
|
def test_nova_compute_extra_flags(self):
|
||||||
|
self.test_config.set('cpu-model-extra-flags', 'pcid vmx pdpe1gb')
|
||||||
|
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'bionic'}
|
||||||
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
|
||||||
|
self.assertEqual(libvirt()['cpu_model_extra_flags'],
|
||||||
|
'pcid, vmx, pdpe1gb')
|
||||||
|
|
||||||
|
|
||||||
class SerialConsoleContextTests(CharmTestCase):
|
class SerialConsoleContextTests(CharmTestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue