From 1d60be37706756c9501dcbc96f34859505091fe1 Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Sun, 18 Oct 2015 19:46:16 +0000 Subject: [PATCH] Allow ceph pool names to be configurable Change-Id: Ic408ef7aec7f1c95396a0ccf0209b104908a3f21 Partially-Implements: blueprint ceph-improvements --- ansible/group_vars/all.yml | 5 +++++ ansible/roles/cinder/tasks/ceph.yml | 8 ++++---- ansible/roles/cinder/templates/cinder.conf.j2 | 4 ++-- ansible/roles/glance/tasks/ceph.yml | 4 ++-- ansible/roles/glance/templates/glance-api.conf.j2 | 2 +- ansible/roles/nova/tasks/ceph.yml | 4 ++-- ansible/roles/nova/templates/nova.conf.j2 | 2 +- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index a44369dd8d..3083be9643 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -176,3 +176,8 @@ cinder_volume_driver: "{{ 'ceph' if enable_ceph | bool else 'lvm' }}" # A requirement for using the erasure-coded pools is you must setup a cache tier # Valid options are [ erasure, replicated ] ceph_pool_type: "replicated" + +ceph_cinder_pool_name: "volumes" +ceph_cinder_backup_pool_name: "backups" +ceph_glance_pool_name: "images" +ceph_nova_pool_name: "vms" diff --git a/ansible/roles/cinder/tasks/ceph.yml b/ansible/roles/cinder/tasks/ceph.yml index a26b99bb24..444d729a9a 100644 --- a/ansible/roles/cinder/tasks/ceph.yml +++ b/ansible/roles/cinder/tasks/ceph.yml @@ -19,7 +19,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Creating ceph pool for cinder - command: docker exec ceph_mon ceph osd pool create volumes 128 {{ ceph_pool_type }} + command: docker exec ceph_mon ceph osd pool create {{ ceph_cinder_pool_name }} 128 {{ ceph_pool_type }} delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False failed_when: False @@ -27,7 +27,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Creating ceph pool for cinder-backup - command: docker exec ceph_mon ceph osd pool create backups 128 {{ ceph_pool_type }} + command: docker exec ceph_mon ceph osd pool create {{ ceph_cinder_backup_pool_name }} 128 {{ ceph_pool_type }} delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False failed_when: False @@ -35,7 +35,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Pulling cephx keyring for cinder - command: docker exec ceph_mon ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images' + command: docker exec ceph_mon ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool={{ ceph_cinder_pool_name }}, allow rwx pool={{ ceph_nova_pool_name }}, allow rx pool={{ ceph_glance_pool_name }}' register: cephx_key_cinder delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False @@ -43,7 +43,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Pulling cephx keyring for cinder-backup - command: docker exec ceph_mon ceph auth get-or-create client.cinder-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups' + command: docker exec ceph_mon ceph auth get-or-create client.cinder-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool={{ ceph_cinder_backup_pool_name }}' register: cephx_key_cinder_backup delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False diff --git a/ansible/roles/cinder/templates/cinder.conf.j2 b/ansible/roles/cinder/templates/cinder.conf.j2 index 9fa0d763bc..ac021e8193 100644 --- a/ansible/roles/cinder/templates/cinder.conf.j2 +++ b/ansible/roles/cinder/templates/cinder.conf.j2 @@ -26,7 +26,7 @@ backup_driver = cinder.backup.drivers.ceph backup_ceph_conf = /etc/ceph/ceph.conf backup_ceph_user = cinder-backup backup_ceph_chunk_size = 134217728 -backup_ceph_pool = backups +backup_ceph_pool = {{ ceph_cinder_backup_pool_name }} backup_ceph_stripe_unit = 0 backup_ceph_stripe_count = 0 restore_discard_excess_bytes = true @@ -71,7 +71,7 @@ volume_backend_name = lvmdriver-1 {% elif cinder_volume_driver == "ceph" %} [rbd-1] volume_driver = cinder.volume.drivers.rbd.RBDDriver -rbd_pool = volumes +rbd_pool = {{ ceph_cinder_pool_name }} rbd_ceph_conf = /etc/ceph/ceph.conf rbd_flatten_volume_from_snapshot = false rbd_max_clone_depth = 5 diff --git a/ansible/roles/glance/tasks/ceph.yml b/ansible/roles/glance/tasks/ceph.yml index f690ecd70e..9dd320c8f3 100644 --- a/ansible/roles/glance/tasks/ceph.yml +++ b/ansible/roles/glance/tasks/ceph.yml @@ -13,7 +13,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Creating ceph pool for glance - command: docker exec ceph_mon ceph osd pool create images 128 {{ ceph_pool_type }} + command: docker exec ceph_mon ceph osd pool create {{ ceph_glance_pool_name }} 128 {{ ceph_pool_type }} delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False failed_when: False @@ -21,7 +21,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Pulling cephx keyring - command: docker exec ceph_mon ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images' + command: docker exec ceph_mon ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool={{ ceph_glance_pool_name }}' register: cephx_key delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False diff --git a/ansible/roles/glance/templates/glance-api.conf.j2 b/ansible/roles/glance/templates/glance-api.conf.j2 index ebb0020332..7d47439f81 100755 --- a/ansible/roles/glance/templates/glance-api.conf.j2 +++ b/ansible/roles/glance/templates/glance-api.conf.j2 @@ -37,7 +37,7 @@ flavor = keystone default_store = rbd stores = rbd rbd_store_user = glance -rbd_store_pool = images +rbd_store_pool = {{ ceph_glance_pool_name }} rbd_store_chunk_size = 8 {% else %} default_store = file diff --git a/ansible/roles/nova/tasks/ceph.yml b/ansible/roles/nova/tasks/ceph.yml index 4f68a469e7..626f09cc1b 100644 --- a/ansible/roles/nova/tasks/ceph.yml +++ b/ansible/roles/nova/tasks/ceph.yml @@ -19,7 +19,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Creating ceph pool for vms - command: docker exec ceph_mon ceph osd pool create vms 128 {{ ceph_pool_type }} + command: docker exec ceph_mon ceph osd pool create {{ ceph_nova_pool_name }} 128 {{ ceph_pool_type }} delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False failed_when: False @@ -27,7 +27,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Pulling cephx keyring for nova - command: docker exec ceph_mon ceph auth get-or-create client.nova mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images' + command: docker exec ceph_mon ceph auth get-or-create client.nova mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool={{ ceph_volumes_pool_name }}, allow rwx pool={{ ceph_nova_pool_name }}, allow rx pool={{ ceph_glance_pool_name }}' register: cephx_key delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False diff --git a/ansible/roles/nova/templates/nova.conf.j2 b/ansible/roles/nova/templates/nova.conf.j2 index 043f47ad08..2d57dd4ecd 100644 --- a/ansible/roles/nova/templates/nova.conf.j2 +++ b/ansible/roles/nova/templates/nova.conf.j2 @@ -121,7 +121,7 @@ password = {{ nova_keystone_password }} {% if enable_ceph | bool %} [libvirt] images_type = rbd -images_rbd_pool = vms +images_rbd_pool = {{ ceph_nova_pool_name }} images_rbd_ceph_conf = /etc/ceph/ceph.conf rbd_user = nova rbd_secret_uuid = {{ rbd_secret_uuid }}