]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
common: support setting pg autoscaler to off
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 14 Apr 2022 12:48:06 +0000 (14:48 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Thu, 14 Apr 2022 13:47:47 +0000 (15:47 +0200)
The current implementation doesn't allow to disable the pg autoscaler
on created pools. This allows only 'on' or 'warn'.

With this commit, this is now possible to disable it.

Valid values would be ['on', 'yes', 'true', 'off', 'no', 'false']

```
openstack_glance_pool:
  name: "images"
  pg_num: 128
  pgp_num: 128
  rule_name: "replicated_rule"
  type: 1
  application: "rbd"
  size: 3
  pg_autoscale_mode: off
```

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2062621
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-client/tasks/create_users_keys.yml
roles/ceph-mds/tasks/create_mds_filesystems.yml
roles/ceph-osd/tasks/openstack_config.yml

index 76cf29c714587d81931b11a3a1701560f2bb8f6d..b1f6eb9b4210666ea0a9a645883b1ba4bee78c18 100644 (file)
       when: item.target_size_ratio is defined
 
     - name: set pg_autoscale_mode value on pool(s)
-      command: "{{ ceph_admin_command | default('') }} --cluster {{ cluster }} osd pool set {{ item.name }} pg_autoscale_mode {{ item.pg_autoscale_mode | default(False) | ternary('on', 'warn') }}"
+      command: "{{ ceph_admin_command | default('') }} --cluster {{ cluster }} osd pool set {{ item.name }} pg_autoscale_mode {{ 'on' if item.pg_autoscale_mode | default('off') | lower in ['on', 'yes', 'true'] else 'off' if item.pg_autoscale_mode | default('off') | lower in ['off', 'no', 'false'] else 'warn' }}"
       delegate_to: "{{ delegated_node }}"
       with_items: "{{ pools | unique }}"
 
index bc3f2cf8b25b34a67d6cb332e567336738a19867..5cd4f2f75a094fd7cc3a8031c19e45ae24ec321b 100644 (file)
@@ -46,7 +46,7 @@
       when: item.target_size_ratio is defined
 
     - name: set pg_autoscale_mode value on pool(s)
-      command: "{{ ceph_run_cmd }} --cluster {{ cluster }} osd pool set {{ item.name }} pg_autoscale_mode {{ item.pg_autoscale_mode | default(False) | ternary('on', 'warn') }}"
+      command: "{{ ceph_run_cmd }} --cluster {{ cluster }} osd pool set {{ item.name }} pg_autoscale_mode {{ 'on' if item.pg_autoscale_mode | default('off') | lower in ['on', 'yes', 'true'] else 'off' if item.pg_autoscale_mode | default('off') | lower in ['off', 'no', 'false'] else 'warn' }}"
       with_items: "{{ cephfs_pools | unique }}"
 
     - name: customize pool size
index 2e869d274b3988e9d37b582cb7c3e2a687b58cd3..1ae8090e0ffeb2569ad22dca42651f422586d4ee 100644 (file)
@@ -39,7 +39,7 @@
       when: item.target_size_ratio is defined
 
     - 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') }}"
+      command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} pg_autoscale_mode {{ 'on' if item.pg_autoscale_mode | default('off') | lower in ['on', 'yes', 'true'] else 'off' if item.pg_autoscale_mode | default('off') | lower in ['off', 'no', 'false'] else 'warn' }}"
       delegate_to: "{{ groups[mon_group_name][0] }}"
       with_items: "{{ openstack_pools | unique }}"