commit 661ee04abd741be8aa27b75f7474855890bffa51 Author: Dmitriy Rabotyagov Date: Thu Sep 24 19:44:48 2020 +0300 Make possible to set nova_libvirt_images_rbd_pool to empty string Checking if nova_libvirt_images_rbd_pool is defined leaves us without an opportunity to disable ceph usage for specific node. Instead of that we will use bool filter, which will be true if line is not empty, and false if it is. That way by setting variable to empty string in host_vars we can disable all relevant options for specific node Change-Id: Id7c03399bd54ac790dcfc28ad1dcd7f6d48979db diff --git a/defaults/main.yml b/defaults/main.yml index 543c6ed..2b23c70 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -257,8 +257,8 @@ nova_libvirt_inject_key: False # -2 => disable, -1 => inspect (libguestfs only), 0 => not partitioned, >0 => partition number nova_libvirt_inject_partition: -2 nova_libvirt_inject_password: False -nova_libvirt_disk_cachemodes: '{{ nova_libvirt_images_rbd_pool is defined | ternary("network=writeback", "") }}' -nova_libvirt_hw_disk_discard: '{{ nova_libvirt_images_rbd_pool is defined | ternary("unmap", "ignore") }}' +nova_libvirt_disk_cachemodes: '{{ nova_libvirt_images_rbd_pool | bool | ternary("network=writeback", "") }}' +nova_libvirt_hw_disk_discard: '{{ nova_libvirt_images_rbd_pool | bool | ternary("unmap", "ignore") }}' nova_libvirt_live_migration_inbound_addr: '{{ (nova_management_address == "localhost") | ternary("127.0.0.1", nova_management_address) }}' ## Nova console @@ -348,6 +348,7 @@ nova_nfs_client: [] # Nova Ceph rbd # Enble and define nova_libvirt_images_rbd_pool to use rbd as nova backend #nova_libvirt_images_rbd_pool: vms +nova_libvirt_images_rbd_pool: '' nova_ceph_client: '{{ cinder_ceph_client }}' # TODO(odyssey4me) - the uuid should be removed, there should be no defaults for secrets nova_ceph_client_uuid: 517a4663-3927-44bc-9ea7-4a90e1cd4c66 @@ -357,7 +358,7 @@ nova_ceph_client_uuid: 517a4663-3927-44bc-9ea7-4a90e1cd4c66 nova_cinder_rbd_inuse: False # Used to determine if we need a Ceph client -nova_rbd_inuse: "{{ (nova_libvirt_images_rbd_pool is defined) or (nova_cinder_rbd_inuse | bool) }}" +nova_rbd_inuse: "{{ (nova_libvirt_images_rbd_pool | bool) or (nova_cinder_rbd_inuse | bool) }}" ## General Nova configuration # If ``nova_conductor_workers`` is unset the system will use half the number of available VCPUS to diff --git a/templates/nova.conf.j2 b/templates/nova.conf.j2 index 1b9ea61..1b4e49f 100644 --- a/templates/nova.conf.j2 +++ b/templates/nova.conf.j2 @@ -228,7 +228,7 @@ cpu_mode = {{ nova_cpu_mode }} rbd_user = {{ nova_ceph_client }} rbd_secret_uuid = {{ nova_ceph_client_uuid }} {% endif %} -{% if nova_libvirt_images_rbd_pool is defined %} +{% if nova_libvirt_images_rbd_pool | bool %} images_type = rbd images_rbd_pool = {{ nova_libvirt_images_rbd_pool }} images_rbd_ceph_conf = /etc/ceph/ceph.conf