]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
rolling-update: utilize noautoscale during update
authorSeena Fallah <seenafallah@gmail.com>
Tue, 27 May 2025 11:11:51 +0000 (13:11 +0200)
committerGuillaume Abrioux <gabrioux@ibm.com>
Wed, 25 Jun 2025 13:41:03 +0000 (15:41 +0200)
Instead of per-pool modification, utilize the already available
flag to disable autoscale during the update temporarily.

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
infrastructure-playbooks/rolling_update.yml
library/ceph_osd_flag.py
tests/library/test_ceph_osd_flag.py

index 65060ff9aff67f756e3f7fd0e50f74c38700afd5..839609a7286bb41517add113b7e368ded13d6bcc 100644 (file)
       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
           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 }}"
           with_items:
             - noout
             - nodeep-scrub
+            - noautoscale
 
 - name: Upgrade ceph osds cluster
   vars:
       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 }}"
           with_items:
             - noout
             - nodeep-scrub
+            - noautoscale
 
         - name: Re-enable balancer
           ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on"
index ef21eaf189a5899a98952d19b50fd2f7c12dc27f..16c4aec13172e856464aeecb673c6f247b22f46a 100644 (file)
@@ -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
         ),
index bbc865eef95ed4a79ced28dd58b55963fb9795d0..3527c90537f72cab54650e33cf756bc453ac3aa3 100644 (file)
@@ -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):