From 6956d74682338008521cd772ce379baa57417442 Mon Sep 17 00:00:00 2001 From: Jiri Podivin Date: Wed, 2 Jun 2021 14:17:25 +0200 Subject: [PATCH] Use and ownership info for the ceph_pools_pg_protection module Adjusted the module level 'DOCUMENTATION' attribute to improve readability/style. Moved long comment into a new, function level docstring. Signed-off-by: Jiri Podivin Change-Id: I09672ce833d2dcb4fac0edbc8149ac44efa12861 --- library/ceph_pools_pg_protection.py | 38 +++++++++++++++++++---------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/library/ceph_pools_pg_protection.py b/library/ceph_pools_pg_protection.py index 861ff2fd8..7416bbe3a 100644 --- a/library/ceph_pools_pg_protection.py +++ b/library/ceph_pools_pg_protection.py @@ -13,7 +13,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - +"""ceph_pools_pg_protection module +Used by the ceph-pg validation. +""" from yaml import safe_load as yaml_safe_load from ansible.module_utils.basic import AnsibleModule @@ -29,7 +31,16 @@ DOCUMENTATION = ''' module: ceph_pools_pg_protection short_description: Warn if Ceph will not create CephPools based on PG and OSD numbers description: - - "The Ceph PG overdose protection check (https://ceph.com/community/new-luminous-pg-overdose-protection) is executed by Ceph before a pool is created. If the check does not pass, then the pool is not created. When TripleO deploys Ceph it triggers ceph-ansible which creates the pools that OpenStack needs. This validation runs the same check that the overdose protection uses to determine if the user should update their CephPools, PG count, or number of OSDs. Without this check a deployer may have to wait until after Ceph is running but before the pools are created to realize the deployment will fail." + - The Ceph PG overdose protection check (https://ceph.com/community/new-luminous-pg-overdose-protection) + is executed by Ceph before a pool is created. + If the check does not pass, then the pool is not created. + - When TripleO deploys Ceph it triggers ceph-ansible which creates the pools that OpenStack needs. + - This validation runs the same check that the overdose protection uses + to determine if the user should update their CephPools, PG count, or number of OSDs. + Without this check a deployer may have to wait until after Ceph is running, + but before the pools are created to realize the deployment will fail. + - Used by the ceph-pg validation. + - Owned by the "DFG:Storage Squad:Ceph" options: num_osds: description: @@ -199,6 +210,18 @@ def simulate_pool_creation(num_osds, ceph_pools, def run_module(): + """This module never changes state of a target system, it only + evaluates if inputs will work when Ceph processes then. + There shouldn't be anything like the following + result['changed'] = True + + This module does not currently have fail options. It should + only evaluate input and make result of the evaluation available. + So it doesn't currently do anything like the following by design. + module.fail_json(msg='Failing for invalid input', **result) + + Exit and pass the key/value results of the simulation + """ # Seed the result dict in the object result = dict( changed=False, @@ -228,17 +251,6 @@ def run_module(): result['message'] = 'Provided CephPools satisfy PG overdose protection' result['valid_input'] = True - # This module never changes state of a target system, it only - # evaluates if inputs will work when Ceph processes then. - # There shouldn't be anything like the following - # result['changed'] = True - - # This module does not currently have fail options. It should - # only evaluate input and make result of the evaluation available. - # So it doesn't currently do anything like the following by design. - # module.fail_json(msg='Failing for invalid input', **result) - - # Exit and pass the key/value results of the simulation module.exit_json(**result)