From 58bad8e6b11931ee09fdc0bec07e426d911dac07 Mon Sep 17 00:00:00 2001 From: Florian Haas Date: Tue, 6 Nov 2018 09:49:56 +0100 Subject: [PATCH] Expose the Libvirt cpu_model and cpu_model_extra_flags options Being able to set cpu_mode to "custom" is nice but doesn't do us much good if users then have to resort to nova_nova_conf_overrides to set cpu_model and/or cpu_model_extra_flags. Instead, honor nova_cpu_model and nova_cpu_model_extra_flags variable. Also add a release note saying that for those users who did previously set these flags via nova_nova_conf_overrides, they should move those bits to the newly understood variables. Change-Id: I889e70826c5c631b86305b512b86fba2b89521b4 --- .../notes/nova-cpu-model-006da20048168842.yaml | 18 ++++++++++++++++++ templates/nova.conf.j2 | 6 ++++++ 2 files changed, 24 insertions(+) create mode 100644 releasenotes/notes/nova-cpu-model-006da20048168842.yaml diff --git a/releasenotes/notes/nova-cpu-model-006da20048168842.yaml b/releasenotes/notes/nova-cpu-model-006da20048168842.yaml new file mode 100644 index 00000000..363bc544 --- /dev/null +++ b/releasenotes/notes/nova-cpu-model-006da20048168842.yaml @@ -0,0 +1,18 @@ +--- +features: + - You can now set the Libvirt CPU model and feature flags from the + appropriate entry under the ``nova_virt_types`` dictionary variable + (normally ``kvm``). + ``nova_cpu_model`` is a string value that sets the CPU model; this + value is ignored if you set any ``nova_cpu_mode`` other than + ``custom``. + ``nova_cpu_model_extra_flags`` is a list that allows you to specify + extra CPU feature flags not normally passed through with + ``host-model``, or the ``custom`` CPU model of your choice. +upgrade: + - If your configuration previously set the ``libvirt/cpu_model`` + and/or ``libvirt/cpu_model_extra_flags`` variables in a + ``nova_nova_conf_overrides`` dictionary, you should consider + moving those to ``nova_cpu_model`` and + ``nova_cpu_model_extra_flags`` in the appropriate entry (normally + ``kvm``) in the ``nova_virt_types`` dictionary. diff --git a/templates/nova.conf.j2 b/templates/nova.conf.j2 index 7b17f75b..b0a1c10a 100644 --- a/templates/nova.conf.j2 +++ b/templates/nova.conf.j2 @@ -258,6 +258,12 @@ virt_type = {{ nova_virt_type }} remove_unused_resized_minimum_age_seconds = {{ nova_remove_unused_resized_minimum_age_seconds }} {% if nova_cpu_mode is defined %} cpu_mode = {{ nova_cpu_mode }} +{% if nova_cpu_mode == 'custom' %} +cpu_model = {{ nova_cpu_model }} +{% endif %} +{% if nova_cpu_model_extra_flags is defined %} +cpu_model_extra_flags = {{ nova_cpu_model_extra_flags | join(',') }} +{% endif %} {% endif %} {% if nova_libvirt_images_rbd_pool is defined %}