From: Seena Fallah Date: Tue, 27 May 2025 11:11:51 +0000 (+0200) Subject: rolling-update: utilize noautoscale during update X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3b0280bfcdd252162f587e2a213082e05431b343;p=ceph-ansible.git rolling-update: utilize noautoscale during update Instead of per-pool modification, utilize the already available flag to disable autoscale during the update temporarily. Signed-off-by: Seena Fallah --- diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index 65060ff9a..839609a72 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -485,12 +485,6 @@ run_once: true delegate_to: "{{ groups[mon_group_name][0] }}" block: - - name: Get pool list - ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json" - register: pool_list - changed_when: false - check_mode: false - - name: Get balancer module status ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json" register: balancer_status_update @@ -498,29 +492,11 @@ changed_when: false check_mode: false - - name: Set_fact pools_pgautoscaler_mode - ansible.builtin.set_fact: - pools_pgautoscaler_mode: "{{ pools_pgautoscaler_mode | default([]) | union([{'name': item.pool_name, 'mode': item.pg_autoscale_mode}]) }}" - with_items: "{{ pool_list.stdout | default('{}') | from_json }}" - - name: Disable balancer ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off" changed_when: false when: (balancer_status_update.stdout | from_json)['active'] | bool - - name: Disable pg autoscale on pools - ceph_pool: - name: "{{ item.name }}" - cluster: "{{ cluster }}" - pg_autoscale_mode: false - with_items: "{{ pools_pgautoscaler_mode }}" - when: - - pools_pgautoscaler_mode is defined - - item.mode == 'on' - environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" - CEPH_CONTAINER_BINARY: "{{ container_binary }}" - - name: Set osd flags ceph_osd_flag: name: "{{ item }}" @@ -531,6 +507,7 @@ with_items: - noout - nodeep-scrub + - noautoscale - name: Upgrade ceph osds cluster vars: @@ -643,19 +620,6 @@ run_once: true delegate_to: "{{ groups[mon_group_name][0] }}" block: - - name: Re-enable pg autoscale on pools - ceph_pool: - name: "{{ item.name }}" - cluster: "{{ cluster }}" - pg_autoscale_mode: true - with_items: "{{ pools_pgautoscaler_mode }}" - when: - - pools_pgautoscaler_mode is defined - - item.mode == 'on' - environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" - CEPH_CONTAINER_BINARY: "{{ container_binary }}" - - name: Unset osd flags ceph_osd_flag: name: "{{ item }}" @@ -667,6 +631,7 @@ with_items: - noout - nodeep-scrub + - noautoscale - name: Re-enable balancer ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on" diff --git a/library/ceph_osd_flag.py b/library/ceph_osd_flag.py index ef21eaf18..16c4aec13 100644 --- a/library/ceph_osd_flag.py +++ b/library/ceph_osd_flag.py @@ -83,7 +83,7 @@ RETURN = '''# ''' def main(): module = AnsibleModule( argument_spec=dict( - name=dict(type='str', required=True, choices=['noup', 'nodown', 'noout', 'nobackfill', 'norebalance', 'norecover', 'noscrub', 'nodeep-scrub']), # noqa: E501 + name=dict(type='str', required=True, choices=['noup', 'nodown', 'noout', 'nobackfill', 'norebalance', 'norecover', 'noscrub', 'nodeep-scrub', 'noautoscale']), # noqa: E501 cluster=dict(type='str', required=False, default='ceph'), state=dict(type='str', required=False, default='present', choices=['present', 'absent']), # noqa: E501 ), diff --git a/tests/library/test_ceph_osd_flag.py b/tests/library/test_ceph_osd_flag.py index bbc865eef..3527c9053 100644 --- a/tests/library/test_ceph_osd_flag.py +++ b/tests/library/test_ceph_osd_flag.py @@ -39,7 +39,7 @@ class TestCephOSDFlagModule(object): result = result.value.args[0] assert result['msg'] == ('value of name must be one of: noup, nodown, ' 'noout, nobackfill, norebalance, norecover, ' - 'noscrub, nodeep-scrub, got: {}'.format(invalid_flag)) + 'noscrub, nodeep-scrub, noautoscale, got: {}'.format(invalid_flag)) @patch('ansible.module_utils.basic.AnsibleModule.exit_json') def test_with_check_mode(self, m_exit_json):