]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
library: add missing `target_size_ratio` parameter support in ceph_pool module
authorFabien Brachere <fabien.brachere@celeste.fr>
Wed, 16 Dec 2020 06:33:36 +0000 (07:33 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 16 Dec 2020 14:10:27 +0000 (15:10 +0100)
When creating a new pool, target_size_ratio was ignored by ansible module ceph_pool.py.
target_size_ratio is now used when pg_autoscale_mode is on.
Tests added to library tests.
This adds too the use in the role ceph-rgw.

Signed-off-by: Fabien Brachere <fabien.brachere@celeste.fr>
library/ceph_pool.py
roles/ceph-rgw/tasks/rgw_create_pools.yml
tests/library/test_ceph_pool.py

index 14ae4e3b63031ca77cfb6fdbd9a500fad55dcb56..d11a9b299a5b962d01479d734b99205207ef4cee 100644 (file)
@@ -395,6 +395,9 @@ def create_pool(cluster,
                      user_pool_config['pg_num']['value'],
                      '--pgp_num',
                      user_pool_config['pgp_num']['value']])
+    elif user_pool_config['target_size_ratio']['value']:
+        args.extend(['--target_size_ratio',
+                     user_pool_config['target_size_ratio']['value']])
 
     if user_pool_config['type']['value'] == 'replicated':
         args.extend([user_pool_config['crush_rule']['value'],
index 6d9918329fde55f24406da7d4d3df05656f6134d..c628d8fb83bfdce8fc7c5fb81800a46a32b4f992 100644 (file)
@@ -37,6 +37,7 @@
     pg_num: "{{ item.value.pg_num | default(omit) }}"
     pgp_num: "{{ item.value.pgp_num | default(omit) }}"
     size: "{{ item.value.size | default(omit) }}"
+    target_size_ratio: "{{ item.value.target_size_ratio | default(omit) }}"
     pool_type: erasure
     erasure_profile: "{{ item.value.ec_profile }}"
     application: rgw
@@ -58,6 +59,7 @@
     pgp_num: "{{ item.value.pgp_num | default(omit) }}"
     size: "{{ item.value.size | default(omit) }}"
     min_size: "{{ item.value.min_size | default(omit) }}"
+    target_size_ratio: "{{ item.value.target_size_ratio | default(omit) }}"
     pool_type: replicated
     rule_name: "{{ item.value.rule_name | default(ceph_osd_pool_default_crush_rule_name) }}"
     application: rgw
index 6716e704c7813e20392f99d6ed9fa8676fb7a23c..c9e831c0816b9a758925fd537f08f8fdcf806f68 100644 (file)
@@ -82,7 +82,7 @@ class TestCephPoolModule(object):
             # 'target_size_ratio' is a key present in the dict above
             # 'options': {}
             # see comment in get_pool_details() for more details
-            'target_size_ratio': None,
+            'target_size_ratio': 0.3,
             'application_metadata': {
                 'rbd': {}
             },
@@ -105,7 +105,7 @@ class TestCephPoolModule(object):
                 'cli_set_opt': 'pg_autoscale_mode'
             },
             'target_size_ratio': {
-                'value': None,
+                'value': '0.3',
                 'cli_set_opt': 'target_size_ratio'
             },
             'application': {
@@ -430,6 +430,8 @@ class TestCephPoolModule(object):
                 'create',
                 self.fake_user_pool_config['pool_name']['value'],
                 self.fake_user_pool_config['type']['value'],
+                '--target_size_ratio',
+                self.fake_user_pool_config['target_size_ratio']['value'],
                 self.fake_user_pool_config['crush_rule']['value'],
                 '--expected_num_objects',
                 self.fake_user_pool_config['expected_num_objects']['value'],
@@ -522,6 +524,8 @@ class TestCephPoolModule(object):
                 'create',
                 self.fake_user_pool_config['pool_name']['value'],
                 self.fake_user_pool_config['type']['value'],
+                '--target_size_ratio',
+                self.fake_user_pool_config['target_size_ratio']['value'],
                 self.fake_user_pool_config['erasure_profile']['value'],
                 self.fake_user_pool_config['crush_rule']['value'],
                 '--expected_num_objects',