Skip to content

Commit

Permalink
switch_to_containers: fix umount ceph partitions
Browse files Browse the repository at this point in the history
When a container is already running on a non containerized node then the
umount ceph partition task is skipped.
This is due to the container ps command which always returns 0 even if
the filter matches nothing.

We should run the umount task when:
1/ the container command is failing (not installed) : rc != 0
2/ the container command reports running ceph-osd containers : rc == 0

Also we should not fail on the ceph directory listing.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1616159

Signed-off-by: Dimitri Savineau <[email protected]>
  • Loading branch information
dsavineau authored and guits committed Dec 2, 2019
1 parent 5bd1cf4 commit 39cfe0a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@

- name: check if containerized osds are already running
command: >
{{ container_binary }} ps --filter='name=ceph-osd'
{{ container_binary }} ps -q --filter='name=ceph-osd'
changed_when: false
failed_when: false
register: osd_running
Expand All @@ -260,14 +260,15 @@
find /var/lib/ceph/osd {% if dmcrypt | bool %}/var/lib/ceph/osd-lockbox{% endif %} -maxdepth 1 -mindepth 1 -type d
register: osd_dirs
changed_when: false
failed_when: false

- name: unmount all the osd directories
command: >
umount {{ item }}
changed_when: false
failed_when: false
with_items: "{{ osd_dirs.stdout_lines }}"
when: osd_running.rc != 0
when: osd_running.rc != 0 or osd_running.stdout_lines | length == 0

tasks:
- import_role:
Expand Down

0 comments on commit 39cfe0a

Please sign in to comment.