Skip to content

Commit

Permalink
day2: set noout at the bucket level instead
Browse files Browse the repository at this point in the history
It is safer to set the `noout` flag at the bucket level instead of the
whole cluster.
This commit updates the 3 playbooks where we set `noout` flag so it
doesn't set it at the whole cluster level anymore.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
  • Loading branch information
guits committed Feb 16, 2022
1 parent d3e3b95 commit 38e9706
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 27 deletions.
31 changes: 20 additions & 11 deletions infrastructure-playbooks/cephadm-adopt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,8 @@
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'


- name: set osd flags
hosts: "{{ osd_group_name|default('osds') }}"
- name: set osd flag nodeep-scrub
hosts: "{{ mon_group_name|default('mons') }}[0]"
become: true
gather_facts: false
any_errors_fatal: True
Expand All @@ -661,15 +661,13 @@
command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json"
register: pool_list
run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false
check_mode: false

- name: get balancer module status
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json"
register: balancer_status_adopt
run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false
check_mode: false

Expand All @@ -692,7 +690,6 @@
cluster: "{{ cluster }}"
pg_autoscale_mode: false
with_items: "{{ pools_pgautoscaler_mode }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
when:
- pools_pgautoscaler_mode is defined
Expand All @@ -709,7 +706,6 @@
with_items:
- noout
- nodeep-scrub
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
Expand All @@ -730,6 +726,12 @@
tasks_from: container_binary.yml
when: containerized_deployment | bool

- name: set osd flag noout
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd set-group noout {{ inventory_hostname }}"
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'

- name: get osd list
ceph_volume:
cluster: "{{ cluster }}"
Expand Down Expand Up @@ -799,8 +801,14 @@
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'

- name: unset osd flags
hosts: "{{ osd_group_name|default('osds') }}"
- name: unset osd flag noout
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd unset-group noout {{ inventory_hostname }}"
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'

- name: unset osd flag nodeep-scrub
hosts: "{{ mon_group_name|default('mons') }}[0]"
become: true
gather_facts: false
any_errors_fatal: True
Expand All @@ -814,7 +822,6 @@
cluster: "{{ cluster }}"
pg_autoscale_mode: true
with_items: "{{ pools_pgautoscaler_mode }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
when:
- pools_pgautoscaler_mode is defined
Expand All @@ -831,16 +838,18 @@
with_items:
- noout
- nodeep-scrub
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true

- name: unset osd flag nodeep-scrub
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd unset nodeep-scrub"
changed_when: false
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: re-enable balancer
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on"
run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false
when: (balancer_status_adopt.stdout | from_json)['active'] | bool

Expand Down
47 changes: 43 additions & 4 deletions infrastructure-playbooks/rolling_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,8 @@
name: ceph-mgr


- name: set osd flags
hosts: "{{ osd_group_name | default('osds') }}"
tags: osds
- name: set osd flag nodeep-scrub
hosts: "{{ mon_group_name | default('mons') }}[0]"
become: True
gather_facts: false
tasks:
Expand All @@ -425,7 +424,6 @@

- name: set osd flags, disable autoscaler and balancer
run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
block:
- name: get pool list
command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json"
Expand Down Expand Up @@ -474,6 +472,14 @@
- noout
- nodeep-scrub

- name: set osd flag nodeep-scrub
ceph_osd_flag:
name: "nodeep-scrub"
cluster: "{{ cluster }}"
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: upgrade ceph osds cluster
vars:
health_osd_check_retries: 600
Expand All @@ -490,6 +496,17 @@
- import_role:
name: ceph-facts

- name: set osd flag noout
ceph_osd_flag:
name: noout
level: bucket
bucket: "{{ inventory_hostname }}"
cluster: "{{ cluster }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
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: get osd numbers - non container
shell: if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi # noqa 306
register: osd_ids
Expand Down Expand Up @@ -553,6 +570,18 @@
retries: "{{ health_osd_check_retries }}"
delay: "{{ health_osd_check_delay }}"

- name: unset osd flag noout
ceph_osd_flag:
name: noout
state: absent
level: bucket
bucket: "{{ inventory_hostname }}"
cluster: "{{ cluster }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
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: complete osd upgrade
hosts: "{{ osd_group_name | default('osds') }}"
Expand Down Expand Up @@ -600,6 +629,16 @@
changed_when: false
when: (balancer_status_update.stdout | from_json)['active'] | bool

- name: unset osd flag nodeep-scrub
ceph_osd_flag:
name: "nodeep-scrub"
cluster: "{{ cluster }}"
state: absent
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: upgrade ceph mdss cluster, deactivate all rank > 0
hosts: "{{ mon_group_name | default('mons') }}[0]"
tags: mdss
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
name: ceph-mgr


- name: set osd flags
- name: set osd flag nodeep-scrub
hosts: "{{ mon_group_name | default('mons') }}[0]"
become: True
tasks:
Expand Down Expand Up @@ -250,16 +250,13 @@
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
- name: set osd flag nodeep-scrub
ceph_osd_flag:
name: "{{ item }}"
name: "nodeep-scrub"
cluster: "{{ cluster }}"
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 }}"
with_items:
- noout
- nodeep-scrub


- name: switching from non-containerized to containerized ceph osd
Expand All @@ -278,6 +275,21 @@
- import_role:
name: ceph-defaults

- import_role:
name: ceph-facts
tasks_from: container_binary.yml

- name: set osd flag noout
ceph_osd_flag:
name: noout
level: bucket
bucket: "{{ inventory_hostname }}"
cluster: "{{ cluster }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
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: collect running osds
shell: |
set -o pipefail;
Expand Down Expand Up @@ -390,8 +402,19 @@
delay: "{{ health_osd_check_delay }}"
changed_when: false

- name: unset osd flag noout
ceph_osd_flag:
name: noout
state: absent
level: bucket
bucket: "{{ inventory_hostname }}"
cluster: "{{ cluster }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
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
- name: unset osd flag nodeep-scrub
hosts: "{{ mon_group_name | default('mons') }}[0]"
become: True
tasks:
Expand All @@ -414,17 +437,14 @@
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
- name: set osd flag nodeep-scrub
ceph_osd_flag:
name: "{{ item }}"
name: "nodeep-scrub"
cluster: "{{ cluster }}"
state: absent
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 }}"
with_items:
- noout
- nodeep-scrub

- name: re-enable balancer
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on"
Expand Down

0 comments on commit 38e9706

Please sign in to comment.