Skip to content

Commit 0981158

Browse files
asm0deuzguits
authored andcommitted
Refresh /etc/ceph/osd json files content before zapping the disks
If the physical disk to device path mapping has changed since the last ceph-volume simple scan (e.g. addition or removal of disks), a wrong disk could be deleted. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2071035 Signed-off-by: Teoman ONAY <tonay@redhat.com> (cherry picked from commit 64e08f2)
1 parent 392ddec commit 0981158

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

infrastructure-playbooks/shrink-osd.yml

+22-2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@
101101
- "{{ osd_hosts }}"
102102
when: hostvars[item.0]['ansible_facts']['hostname'] == item.1
103103

104+
- name: set_fact host_list
105+
set_fact:
106+
host_list: "{{ host_list | default([]) | union([item.0]) }}"
107+
loop: "{{ _osd_hosts }}"
108+
104109
- name: get ceph-volume lvm list data
105110
ceph_volume:
106111
cluster: "{{ cluster }}"
@@ -109,14 +114,29 @@
109114
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
110115
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
111116
register: _lvm_list_data
112-
delegate_to: "{{ item.0 }}"
113-
loop: "{{ _osd_hosts }}"
117+
delegate_to: "{{ item }}"
118+
loop: "{{ host_list }}"
114119

115120
- name: set_fact _lvm_list
116121
set_fact:
117122
_lvm_list: "{{ _lvm_list | default({}) | combine(item.stdout | from_json) }}"
118123
with_items: "{{ _lvm_list_data.results }}"
119124

125+
- name: refresh /etc/ceph/osd files non containerized_deployment
126+
ceph_volume_simple_scan:
127+
cluster: "{{ cluster }}"
128+
force: true
129+
delegate_to: "{{ item }}"
130+
loop: "{{ host_list }}"
131+
when: not containerized_deployment | bool
132+
133+
- name: refresh /etc/ceph/osd files containerized_deployment
134+
command: "{{ container_binary }} exec ceph-osd-{{ item.2 }} ceph-volume simple scan --force /var/lib/ceph/osd/{{ cluster }}-{{ item.2 }}"
135+
changed_when: false
136+
delegate_to: "{{ item.0 }}"
137+
loop: "{{ _osd_hosts }}"
138+
when: containerized_deployment | bool
139+
120140
- name: find /etc/ceph/osd files
121141
find:
122142
paths: /etc/ceph/osd

0 commit comments

Comments
 (0)