osd: add pg autoscaler support

This commit adds the pg autoscaler support.

The structure for pool definition has now two additional attributes
`pg_autoscale_mode` and `target_size_ratio`, eg:

```
test:
  name: "test"
  pg_num: "{{ osd_pool_default_pg_num }}"
  pgp_num: "{{ osd_pool_default_pg_num }}"
  rule_name: "replicated_rule"
  application: "rbd"
  type: 1
  erasure_profile: ""
  expected_num_objects: ""
  size: "{{ osd_pool_default_size }}"
  min_size: "{{ osd_pool_default_min_size }}"
  pg_autoscale_mode: False
  target_size_ratio": 0.1
```

when `pg_autoscale_mode` is `True` user has to set a decent value in
`target_size_ratio`.

Given that it's a new feature, it's still disabled by default.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1782253

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/4545/head
Guillaume Abrioux 2020-02-28 16:03:15 +01:00 committed by Dimitri Savineau
parent bf1f125d71
commit 47adc2bb08
9 changed files with 212 additions and 15 deletions

View File

@ -335,6 +335,22 @@ dummy:
########## ##########
# CEPHFS # # CEPHFS #
########## ##########
# When pg_autoscale_mode is set to True, you must add the target_size_ratio key with a correct value
# `pg_num` and `pgp_num` keys will be ignored, even if specified.
# eg:
# cephfs_data_pool:
# name: "{{ cephfs_data if cephfs_data is defined else 'cephfs_data' }}"
# pg_num: "{{ osd_pool_default_pg_num }}"
# pgp_num: "{{ osd_pool_default_pg_num }}"
# rule_name: "replicated_rule"
# type: 1
# erasure_profile: ""
# expected_num_objects: ""
# application: "cephfs"
# size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
# target_size_ratio: 0.2
#cephfs: cephfs # name of the ceph filesystem #cephfs: cephfs # name of the ceph filesystem
#cephfs_data_pool: #cephfs_data_pool:
# name: "{{ cephfs_data if cephfs_data is defined else 'cephfs_data' }}" # name: "{{ cephfs_data if cephfs_data is defined else 'cephfs_data' }}"
@ -347,6 +363,7 @@ dummy:
# application: "cephfs" # application: "cephfs"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#cephfs_metadata_pool: #cephfs_metadata_pool:
# name: "{{ cephfs_metadata if cephfs_metadata is defined else 'cephfs_metadata' }}" # name: "{{ cephfs_metadata if cephfs_metadata is defined else 'cephfs_metadata' }}"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -358,6 +375,7 @@ dummy:
# application: "cephfs" # application: "cephfs"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#cephfs_pools: #cephfs_pools:
# - "{{ cephfs_data_pool }}" # - "{{ cephfs_data_pool }}"
# - "{{ cephfs_metadata_pool }}" # - "{{ cephfs_metadata_pool }}"
@ -601,6 +619,22 @@ dummy:
# OPENSTACK # # OPENSTACK #
############# #############
#openstack_config: false #openstack_config: false
# When pg_autoscale_mode is set to True, you must add the target_size_ratio key with a correct value
# `pg_num` and `pgp_num` keys will be ignored, even if specified.
# eg:
# openstack_glance_pool:
# name: "images"
# pg_num: "{{ osd_pool_default_pg_num }}"
# pgp_num: "{{ osd_pool_default_pg_num }}"
# rule_name: "replicated_rule"
# type: 1
# erasure_profile: ""
# expected_num_objects: ""
# application: "rbd"
# size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
# target_size_ratio: 0.2
#openstack_glance_pool: #openstack_glance_pool:
# name: "images" # name: "images"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -612,6 +646,7 @@ dummy:
# application: "rbd" # application: "rbd"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_cinder_pool: #openstack_cinder_pool:
# name: "volumes" # name: "volumes"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -623,6 +658,7 @@ dummy:
# application: "rbd" # application: "rbd"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_nova_pool: #openstack_nova_pool:
# name: "vms" # name: "vms"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -634,6 +670,7 @@ dummy:
# application: "rbd" # application: "rbd"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_cinder_backup_pool: #openstack_cinder_backup_pool:
# name: "backups" # name: "backups"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -645,6 +682,7 @@ dummy:
# application: "rbd" # application: "rbd"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_gnocchi_pool: #openstack_gnocchi_pool:
# name: "metrics" # name: "metrics"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -656,6 +694,7 @@ dummy:
# application: "rbd" # application: "rbd"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_cephfs_data_pool: #openstack_cephfs_data_pool:
# name: "manila_data" # name: "manila_data"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -667,6 +706,7 @@ dummy:
# application: "cephfs" # application: "cephfs"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_cephfs_metadata_pool: #openstack_cephfs_metadata_pool:
# name: "manila_metadata" # name: "manila_metadata"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -678,7 +718,7 @@ dummy:
# application: "cephfs" # application: "cephfs"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_pools: #openstack_pools:
# - "{{ openstack_glance_pool }}" # - "{{ openstack_glance_pool }}"
# - "{{ openstack_cinder_pool }}" # - "{{ openstack_cinder_pool }}"

View File

@ -18,6 +18,22 @@ dummy:
#copy_admin_key: false #copy_admin_key: false
#user_config: false #user_config: false
# When pg_autoscale_mode is set to True, you must add the target_size_ratio key with a correct value
# `pg_num` and `pgp_num` keys will be ignored, even if specified.
# eg:
# test:
# name: "test"
# pg_num: "{{ osd_pool_default_pg_num }}"
# pgp_num: "{{ osd_pool_default_pg_num }}"
# rule_name: "replicated_rule"
# application: "rbd"
# type: 1
# erasure_profile: ""
# expected_num_objects: ""
# size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
# target_size_ratio: 0.2
#test: #test:
# name: "test" # name: "test"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -29,6 +45,7 @@ dummy:
# expected_num_objects: "" # expected_num_objects: ""
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#test2: #test2:
# name: "test2" # name: "test2"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -40,6 +57,7 @@ dummy:
# expected_num_objects: "" # expected_num_objects: ""
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#pools: #pools:
# - "{{ test }}" # - "{{ test }}"
# - "{{ test2 }}" # - "{{ test2 }}"

View File

@ -335,6 +335,22 @@ ceph_iscsi_config_dev: false
########## ##########
# CEPHFS # # CEPHFS #
########## ##########
# When pg_autoscale_mode is set to True, you must add the target_size_ratio key with a correct value
# `pg_num` and `pgp_num` keys will be ignored, even if specified.
# eg:
# cephfs_data_pool:
# name: "{{ cephfs_data if cephfs_data is defined else 'cephfs_data' }}"
# pg_num: "{{ osd_pool_default_pg_num }}"
# pgp_num: "{{ osd_pool_default_pg_num }}"
# rule_name: "replicated_rule"
# type: 1
# erasure_profile: ""
# expected_num_objects: ""
# application: "cephfs"
# size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
# target_size_ratio: 0.2
#cephfs: cephfs # name of the ceph filesystem #cephfs: cephfs # name of the ceph filesystem
#cephfs_data_pool: #cephfs_data_pool:
# name: "{{ cephfs_data if cephfs_data is defined else 'cephfs_data' }}" # name: "{{ cephfs_data if cephfs_data is defined else 'cephfs_data' }}"
@ -347,6 +363,7 @@ ceph_iscsi_config_dev: false
# application: "cephfs" # application: "cephfs"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#cephfs_metadata_pool: #cephfs_metadata_pool:
# name: "{{ cephfs_metadata if cephfs_metadata is defined else 'cephfs_metadata' }}" # name: "{{ cephfs_metadata if cephfs_metadata is defined else 'cephfs_metadata' }}"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -358,6 +375,7 @@ ceph_iscsi_config_dev: false
# application: "cephfs" # application: "cephfs"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#cephfs_pools: #cephfs_pools:
# - "{{ cephfs_data_pool }}" # - "{{ cephfs_data_pool }}"
# - "{{ cephfs_metadata_pool }}" # - "{{ cephfs_metadata_pool }}"
@ -601,6 +619,22 @@ ceph_docker_registry_auth: true
# OPENSTACK # # OPENSTACK #
############# #############
#openstack_config: false #openstack_config: false
# When pg_autoscale_mode is set to True, you must add the target_size_ratio key with a correct value
# `pg_num` and `pgp_num` keys will be ignored, even if specified.
# eg:
# openstack_glance_pool:
# name: "images"
# pg_num: "{{ osd_pool_default_pg_num }}"
# pgp_num: "{{ osd_pool_default_pg_num }}"
# rule_name: "replicated_rule"
# type: 1
# erasure_profile: ""
# expected_num_objects: ""
# application: "rbd"
# size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
# target_size_ratio: 0.2
#openstack_glance_pool: #openstack_glance_pool:
# name: "images" # name: "images"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -612,6 +646,7 @@ ceph_docker_registry_auth: true
# application: "rbd" # application: "rbd"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_cinder_pool: #openstack_cinder_pool:
# name: "volumes" # name: "volumes"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -623,6 +658,7 @@ ceph_docker_registry_auth: true
# application: "rbd" # application: "rbd"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_nova_pool: #openstack_nova_pool:
# name: "vms" # name: "vms"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -634,6 +670,7 @@ ceph_docker_registry_auth: true
# application: "rbd" # application: "rbd"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_cinder_backup_pool: #openstack_cinder_backup_pool:
# name: "backups" # name: "backups"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -645,6 +682,7 @@ ceph_docker_registry_auth: true
# application: "rbd" # application: "rbd"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_gnocchi_pool: #openstack_gnocchi_pool:
# name: "metrics" # name: "metrics"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -656,6 +694,7 @@ ceph_docker_registry_auth: true
# application: "rbd" # application: "rbd"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_cephfs_data_pool: #openstack_cephfs_data_pool:
# name: "manila_data" # name: "manila_data"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -667,6 +706,7 @@ ceph_docker_registry_auth: true
# application: "cephfs" # application: "cephfs"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_cephfs_metadata_pool: #openstack_cephfs_metadata_pool:
# name: "manila_metadata" # name: "manila_metadata"
# pg_num: "{{ osd_pool_default_pg_num }}" # pg_num: "{{ osd_pool_default_pg_num }}"
@ -678,7 +718,7 @@ ceph_docker_registry_auth: true
# application: "cephfs" # application: "cephfs"
# size: "{{ osd_pool_default_size }}" # size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}" # min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
#openstack_pools: #openstack_pools:
# - "{{ openstack_glance_pool }}" # - "{{ openstack_glance_pool }}"
# - "{{ openstack_cinder_pool }}" # - "{{ openstack_cinder_pool }}"

View File

@ -10,6 +10,22 @@
copy_admin_key: false copy_admin_key: false
user_config: false user_config: false
# When pg_autoscale_mode is set to True, you must add the target_size_ratio key with a correct value
# `pg_num` and `pgp_num` keys will be ignored, even if specified.
# eg:
# test:
# name: "test"
# pg_num: "{{ osd_pool_default_pg_num }}"
# pgp_num: "{{ osd_pool_default_pg_num }}"
# rule_name: "replicated_rule"
# application: "rbd"
# type: 1
# erasure_profile: ""
# expected_num_objects: ""
# size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
# target_size_ratio: 0.2
test: test:
name: "test" name: "test"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
@ -21,6 +37,7 @@ test:
expected_num_objects: "" expected_num_objects: ""
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
test2: test2:
name: "test2" name: "test2"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
@ -32,6 +49,7 @@ test2:
expected_num_objects: "" expected_num_objects: ""
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
pools: pools:
- "{{ test }}" - "{{ test }}"
- "{{ test2 }}" - "{{ test2 }}"

View File

@ -83,17 +83,16 @@
command: > command: >
{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} {{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }}
osd pool create {{ item.0.name }} osd pool create {{ item.0.name }}
{{ item.0.pg_num | default(osd_pool_default_pg_num) }} {{ item.0.pg_num | default(osd_pool_default_pg_num) if not item.0.pg_autoscale_mode | default(False) | bool else 16 }}
{{ item.0.pgp_num | default(item.0.pg_num) | default(osd_pool_default_pg_num) }} {{ item.0.pgp_num | default(item.0.pg_num) | default(osd_pool_default_pg_num) if not item.0.pg_autoscale_mode | default(False) | bool else '' }}
{%- if item.0.type | default(1) | int == 1 or item.0.type | default('replicated') == 'replicated' %} {%- if item.0.type | default(1) | int == 1 or item.0.type | default('replicated') == 'replicated' %}
replicated replicated
{{ item.0.rule_name | default(osd_pool_default_crush_rule) }} {{ item.0.rule_name | default(osd_pool_default_crush_rule) }}
{{ item.0.expected_num_objects | default(0) }}
{%- else %} {%- else %}
erasure erasure
{{ item.0.erasure_profile }} {{ item.0.erasure_profile }}
{{ item.0.rule_name | default('erasure-code') }}
{%- endif %} {%- endif %}
{{ item.0.expected_num_objects | default(0) }}
with_together: with_together:
- "{{ pools }}" - "{{ pools }}"
- "{{ created_pools.results }}" - "{{ created_pools.results }}"
@ -103,6 +102,17 @@
- pools | length > 0 - pools | length > 0
- item.1.rc != 0 - item.1.rc != 0
- name: set the target ratio on pool(s)
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} target_size_ratio {{ item.target_size_ratio }}"
with_items: "{{ pools | unique }}"
delegate_to: "{{ delegated_node }}"
when: item.pg_autoscale_mode | default(False) | bool
- name: set pg_autoscale_mode value on pool(s)
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} pg_autoscale_mode {{ item.pg_autoscale_mode | default(False) | ternary('on', 'warn') }}"
delegate_to: "{{ delegated_node }}"
with_items: "{{ pools | unique }}"
- name: customize pool size - name: customize pool size
command: > command: >
{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} {{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }}

View File

@ -327,6 +327,22 @@ mon_host_v2:
########## ##########
# CEPHFS # # CEPHFS #
########## ##########
# When pg_autoscale_mode is set to True, you must add the target_size_ratio key with a correct value
# `pg_num` and `pgp_num` keys will be ignored, even if specified.
# eg:
# cephfs_data_pool:
# name: "{{ cephfs_data if cephfs_data is defined else 'cephfs_data' }}"
# pg_num: "{{ osd_pool_default_pg_num }}"
# pgp_num: "{{ osd_pool_default_pg_num }}"
# rule_name: "replicated_rule"
# type: 1
# erasure_profile: ""
# expected_num_objects: ""
# application: "cephfs"
# size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
# target_size_ratio: 0.2
cephfs: cephfs # name of the ceph filesystem cephfs: cephfs # name of the ceph filesystem
cephfs_data_pool: cephfs_data_pool:
name: "{{ cephfs_data if cephfs_data is defined else 'cephfs_data' }}" name: "{{ cephfs_data if cephfs_data is defined else 'cephfs_data' }}"
@ -339,6 +355,7 @@ cephfs_data_pool:
application: "cephfs" application: "cephfs"
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
cephfs_metadata_pool: cephfs_metadata_pool:
name: "{{ cephfs_metadata if cephfs_metadata is defined else 'cephfs_metadata' }}" name: "{{ cephfs_metadata if cephfs_metadata is defined else 'cephfs_metadata' }}"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
@ -350,6 +367,7 @@ cephfs_metadata_pool:
application: "cephfs" application: "cephfs"
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
cephfs_pools: cephfs_pools:
- "{{ cephfs_data_pool }}" - "{{ cephfs_data_pool }}"
- "{{ cephfs_metadata_pool }}" - "{{ cephfs_metadata_pool }}"
@ -593,6 +611,22 @@ docker_pull_timeout: "300s"
# OPENSTACK # # OPENSTACK #
############# #############
openstack_config: false openstack_config: false
# When pg_autoscale_mode is set to True, you must add the target_size_ratio key with a correct value
# `pg_num` and `pgp_num` keys will be ignored, even if specified.
# eg:
# openstack_glance_pool:
# name: "images"
# pg_num: "{{ osd_pool_default_pg_num }}"
# pgp_num: "{{ osd_pool_default_pg_num }}"
# rule_name: "replicated_rule"
# type: 1
# erasure_profile: ""
# expected_num_objects: ""
# application: "rbd"
# size: "{{ osd_pool_default_size }}"
# min_size: "{{ osd_pool_default_min_size }}"
# pg_autoscale_mode: False
# target_size_ratio: 0.2
openstack_glance_pool: openstack_glance_pool:
name: "images" name: "images"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
@ -604,6 +638,7 @@ openstack_glance_pool:
application: "rbd" application: "rbd"
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
openstack_cinder_pool: openstack_cinder_pool:
name: "volumes" name: "volumes"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
@ -615,6 +650,7 @@ openstack_cinder_pool:
application: "rbd" application: "rbd"
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
openstack_nova_pool: openstack_nova_pool:
name: "vms" name: "vms"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
@ -626,6 +662,7 @@ openstack_nova_pool:
application: "rbd" application: "rbd"
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
openstack_cinder_backup_pool: openstack_cinder_backup_pool:
name: "backups" name: "backups"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
@ -637,6 +674,7 @@ openstack_cinder_backup_pool:
application: "rbd" application: "rbd"
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
openstack_gnocchi_pool: openstack_gnocchi_pool:
name: "metrics" name: "metrics"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
@ -648,6 +686,7 @@ openstack_gnocchi_pool:
application: "rbd" application: "rbd"
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
openstack_cephfs_data_pool: openstack_cephfs_data_pool:
name: "manila_data" name: "manila_data"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
@ -659,6 +698,7 @@ openstack_cephfs_data_pool:
application: "cephfs" application: "cephfs"
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
openstack_cephfs_metadata_pool: openstack_cephfs_metadata_pool:
name: "manila_metadata" name: "manila_metadata"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
@ -670,7 +710,7 @@ openstack_cephfs_metadata_pool:
application: "cephfs" application: "cephfs"
size: "{{ osd_pool_default_size }}" size: "{{ osd_pool_default_size }}"
min_size: "{{ osd_pool_default_min_size }}" min_size: "{{ osd_pool_default_min_size }}"
pg_autoscale_mode: False
openstack_pools: openstack_pools:
- "{{ openstack_glance_pool }}" - "{{ openstack_glance_pool }}"
- "{{ openstack_cinder_pool }}" - "{{ openstack_cinder_pool }}"

View File

@ -25,21 +25,31 @@
command: > command: >
{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} {{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }}
osd pool create {{ item.name }} osd pool create {{ item.name }}
{{ item.pg_num | default(osd_pool_default_pg_num) }} {{ item.pg_num | default(osd_pool_default_pg_num) if not item.pg_autoscale_mode | default(False) | bool else 16 }}
{{ item.pgp_num | default(item.pg_num) | default(osd_pool_default_pg_num) }} {{ item.pgp_num | default(item.pg_num) | default(osd_pool_default_pg_num) if not item.pg_autoscale_mode | default(False) | bool else '' }}
{%- if item.type | default(1) | int == 1 or item.type | default('replicated') == 'replicated' %} {%- if item.type | default(1) | int == 1 or item.type | default('replicated') == 'replicated' %}
replicated replicated
{{ item.rule_name | default(osd_pool_default_crush_rule) }} {{ item.rule_name | default(osd_pool_default_crush_rule) }}
{{ item.expected_num_objects | default(0) }}
{%- else %} {%- else %}
erasure erasure
{{ item.erasure_profile }} {{ item.erasure_profile }}
{{ item.rule_name | default('erasure-code') }}
{%- endif %} {%- endif %}
{{ item.expected_num_objects | default(0) }}
changed_when: false changed_when: false
with_items: with_items:
- "{{ cephfs_pools }}" - "{{ cephfs_pools }}"
- name: set the target ratio on pool(s)
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} target_size_ratio {{ item.target_size_ratio }}"
with_items: "{{ cephfs_pools | unique }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
when: item.pg_autoscale_mode | default(False) | bool
- name: set pg_autoscale_mode value on pool(s)
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} pg_autoscale_mode {{ item.pg_autoscale_mode | default(False) | ternary('on', 'warn') }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
with_items: "{{ cephfs_pools | unique }}"
- name: customize pool size - name: customize pool size
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} size {{ item.size | default(osd_pool_default_size) }}" command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} size {{ item.size | default(osd_pool_default_size) }}"
with_items: "{{ cephfs_pools | unique }}" with_items: "{{ cephfs_pools | unique }}"

View File

@ -15,17 +15,16 @@
command: > command: >
{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} {{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }}
osd pool create {{ item.0.name }} osd pool create {{ item.0.name }}
{{ item.0.pg_num | default(osd_pool_default_pg_num) }} {{ item.0.pg_num | default(osd_pool_default_pg_num) if not item.0.pg_autoscale_mode | default(False) | bool else 16 }}
{{ item.0.pgp_num | default(item.0.pg_num) | default(osd_pool_default_pg_num) }} {{ item.0.pgp_num | default(item.0.pg_num) | default(osd_pool_default_pg_num) if not item.0.pg_autoscale_mode | default(False) | bool else '' }}
{%- if item.0.type | default(1) | int == 1 or item.0.type | default('replicated') == 'replicated' %} {%- if item.0.type | default(1) | int == 1 or item.0.type | default('replicated') == 'replicated' %}
replicated replicated
{{ item.0.rule_name | default(osd_pool_default_crush_rule) }} {{ item.0.rule_name | default(osd_pool_default_crush_rule) }}
{{ item.0.expected_num_objects | default(0) }}
{%- else %} {%- else %}
erasure erasure
{{ item.0.erasure_profile }} {{ item.0.erasure_profile }}
{{ item.0.rule_name | default('erasure-code') }}
{%- endif %} {%- endif %}
{{ item.0.expected_num_objects | default(0) }}
with_together: with_together:
- "{{ openstack_pools | unique }}" - "{{ openstack_pools | unique }}"
- "{{ created_pools.results }}" - "{{ created_pools.results }}"
@ -33,6 +32,17 @@
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
when: item.1.get('rc', 0) != 0 when: item.1.get('rc', 0) != 0
- name: set the target ratio on pool(s)
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} target_size_ratio {{ item.target_size_ratio }}"
with_items: "{{ openstack_pools | unique }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
when: item.pg_autoscale_mode | default(False) | bool
- name: set pg_autoscale_mode value on pool(s)
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} pg_autoscale_mode {{ item.pg_autoscale_mode | default(False) | ternary('on', 'warn') }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
with_items: "{{ openstack_pools | unique }}"
- name: customize pool size - name: customize pool size
command: > command: >
{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} {{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }}

View File

@ -0,0 +1,11 @@
---
- name: fail if target_size_ratio is not set when pg_autoscale_mode is True
fail:
msg: "You must set a target_size_ratio value on following pool: {{ item.name }}."
with_items:
- "{{ openstack_pools | default([]) }}"
- "{{ cephfs_pools | default([]) }}"
- "{{ pools | default([]) }}"
when:
- item.pg_autoscale_mode | default(False) | bool
- item.target_size_ratio is undefined