refact osd pool size customization

Add real default value for osd pool size customization.
Ceph itself has an `osd_pool_default_size` default value to `3`.

If users don't specify a pool size in various pools definition within
ceph-ansible, we should default to `3`.

By the way, this kind of condition isn't really clear:
```
when:
  - rbd_pool_size | default ("")
```

we should try to get the customized value then default to what is in
`osd_pool_default_size` (which has its default value pointing to
`ceph_osd_pool_default_size` (`3`) as well) and compare it to
`ceph_osd_pool_default_size`.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 7774069d45)
pull/3384/head
Guillaume Abrioux 2018-11-21 11:00:11 +01:00 committed by mergify[bot]
parent 68b2ad11ee
commit f0195e97ed
8 changed files with 19 additions and 12 deletions

View File

@ -64,7 +64,7 @@ dummy:
# Whether or not to generate secure certificate to iSCSI gateway nodes
#generate_crt: False
#rbd_pool_size: ""
#rbd_pool_size: "{{ osd_pool_default_size }}"
##################
# RBD-TARGET-API #

View File

@ -122,13 +122,13 @@
- name: customize pool size
command: >
{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }}
osd pool set {{ item.name }} size {{ item.size | default('') }}
osd pool set {{ item.name }} size {{ item.size | default(osd_pool_default_size) }}
with_items: "{{ pools | unique }}"
delegate_to: "{{ delegated_node }}"
changed_when: false
when:
- pools | length > 0
- item.size | default ("") != ""
- item.size | default(osd_pool_default_size) != ceph_osd_pool_default_size
- name: get client cephx keys
copy:

View File

@ -244,5 +244,9 @@
set_fact:
osd_pool_default_pg_num: "{{ ceph_conf_overrides.get('global', {}).get('osd_pool_default_pg_num', ceph_osd_pool_default_pg_num) }}"
- name: set_fact osd_pool_default_size
set_fact:
osd_pool_default_size: "{{ ceph_conf_overrides.get('global', {}).get('osd_pool_default_size', ceph_osd_pool_default_size) }}"
- name: populate service facts
service_facts:

View File

@ -56,7 +56,7 @@ client_connections: {}
# Whether or not to generate secure certificate to iSCSI gateway nodes
generate_crt: False
rbd_pool_size: ""
rbd_pool_size: "{{ osd_pool_default_size }}"
##################
# RBD-TARGET-API #

View File

@ -41,8 +41,8 @@
delegate_to: "{{ groups[mon_group_name][0] }}"
- name: customize pool size
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool set rbd size {{ rbd_pool_size | default('') }}"
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool set rbd size {{ rbd_pool_size | default(osd_pool_default_size) }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false
when:
- rbd_pool_size | default ("") != ""
- rbd_pool_size | default(osd_pool_default_size) != ceph_osd_pool_default_size

View File

@ -9,11 +9,12 @@
- "{{ cephfs_pools }}"
- name: customize pool size
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} size {{ item.size | default('') }}"
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} size {{ item.size | default(osd_pool_default_size) }}"
with_items: "{{ cephfs_pools | unique }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false
when: item.size | default ("") != ""
when:
- item.size | default(osd_pool_default_size) != ceph_osd_pool_default_size
- name: check if ceph filesystem already exists
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} fs get {{ cephfs }}"

View File

@ -43,11 +43,12 @@
- name: customize pool size
command: >
{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }}
osd pool set {{ item.name }} size {{ item.size | default('') }}
osd pool set {{ item.name }} size {{ item.size | default(osd_pool_default_size) }}
with_items: "{{ openstack_pools | unique }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false
when: item.size | default ("") != ""
when:
- item.size | default(osd_pool_default_size) != ceph_osd_pool_default_size
- name: assign application to pool(s)
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool application enable {{ item.name }} {{ item.application }}"

View File

@ -34,9 +34,10 @@
run_once: true
- name: customize pool size
command: "{{ docker_exec_cmd }} ceph --connect-timeout 5 --cluster {{ cluster }} osd pool set {{ item.key }} size {{ item.size | default('') }}"
command: "{{ docker_exec_cmd }} ceph --connect-timeout 5 --cluster {{ cluster }} osd pool set {{ item.key }} size {{ item.size | default(osd_pool_default_size) }}"
with_dict: "{{ rgw_create_pools }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false
run_once: true
when: item.size | default ("") != ""
when:
- item.size | default(osd_pool_default_size) != ceph_osd_pool_default_size