]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
switch_to_containers: fix umount ceph partitions v3.2.37
authorDimitri Savineau <dsavinea@redhat.com>
Wed, 27 Nov 2019 16:27:09 +0000 (11:27 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 3 Dec 2019 14:58:57 +0000 (15:58 +0100)
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 <dsavinea@redhat.com>
(cherry picked from commit 39cfe0aa65ddd96458ba9d0a031d801efbb0d394)

infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml

index 972e7b6b1dda850f429d2ee0287508909f40f24c..350a4dd11e87b9ec2de520be1f578eb710cb6dd3 100644 (file)
 
     - name: check if containerized osds are already running
       command: >
-        docker ps --filter='name=ceph-osd'
+        docker ps -q --filter='name=ceph-osd'
       changed_when: false
       failed_when: false
       register: osd_running
         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
+      with_items: "{{ osd_dirs.stdout_lines }}"
+      when: osd_running.rc != 0 or osd_running.stdout_lines | length == 0
+
 
   roles:
     - ceph-defaults