From 12a5bc7a9f0bb4bfef4b6d5fc565e9dfeba17690 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Tue, 30 Jul 2019 12:32:33 -0400 Subject: [PATCH] rbd: add var for inuse and enable setting secret This patch refactors a variable to determine if we RBD is in use (either directly or via cinder-volume). It also uses this to make sure to always set rbd_user and the rbd_secret_uuid both are set so booting from Cinder with local storage works. Change-Id: I052f50cd527ea222e74fdc3684613499f2b55d8e --- defaults/main.yml | 3 +++ tasks/main.yml | 5 ++--- templates/nova.conf.j2 | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 85a60ba2..896f5573 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -393,6 +393,9 @@ nova_ceph_client_uuid: 517a4663-3927-44bc-9ea7-4a90e1cd4c66 # ceph be deployed on the nova compute hosts to enable volume backed instances. 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)" + ## General Nova configuration # If ``nova_osapi_compute_workers`` is unset the system will use half the number of available VCPUS to # compute the number of api workers to use. diff --git a/tasks/main.yml b/tasks/main.yml index e4322ab6..501075c3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -232,9 +232,8 @@ openstack_service_venv_bin: "{{ nova_bin }}" when: - nova_virt_type != 'ironic' - - "nova_services['nova-compute']['group'] in group_names" - - "(nova_libvirt_images_rbd_pool is defined) or - (nova_cinder_rbd_inuse | bool)" + - nova_services['nova-compute']['group'] in group_names + - nova_rbd_inuse | bool tags: - ceph diff --git a/templates/nova.conf.j2 b/templates/nova.conf.j2 index dcd63cd4..5aa98cce 100644 --- a/templates/nova.conf.j2 +++ b/templates/nova.conf.j2 @@ -250,10 +250,12 @@ cpu_model_extra_flags = {{ nova_cpu_model_extra_flags | join(',') }} {% endif %} {% endif %} -{% if nova_libvirt_images_rbd_pool is defined %} +{% if nova_rbd_inuse %} # ceph rbd support rbd_user = {{ nova_ceph_client }} rbd_secret_uuid = {{ nova_ceph_client_uuid }} +{% endif %} +{% if nova_libvirt_images_rbd_pool is defined %} images_type = rbd images_rbd_pool = {{ nova_libvirt_images_rbd_pool }} images_rbd_ceph_conf = /etc/ceph/ceph.conf