]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge-cluster: use sysfs method for unmapping rbd devices
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 4 Aug 2020 15:29:41 +0000 (17:29 +0200)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Fri, 11 Sep 2020 00:35:16 +0000 (20:35 -0400)
This way we keep consistency with purge-container-cluster.yml playbook.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit f77fa6e2a4d4c2b4522582f53713c2e49fecbe12)

infrastructure-playbooks/purge-cluster.yml

index 57630793753f12ff9db836ff373e0aa291e769e6..d673e925fc8923a14f8d0dea896bb1fe31e45bd8 100644 (file)
     - name: ensure cephfs mountpoint(s) are unmounted
       command: umount -a -t ceph
 
-    - name: check if rbdmap is still installed
-      command: command -v rbdmap
-      register: command_rbdmap
-      failed_when: false
-      changed_when: false
-
-    - name: ensure rbd devices are unmapped
-      command: rbdmap unmap-all
-      when: command_rbdmap.rc == 0
+    - name: find mapped rbd ids
+      find:
+        paths: /sys/bus/rbd/devices
+        file_type: any
+      register: rbd_mapped_ids
+
+    - name: use sysfs to unmap rbd devices
+      shell: "echo {{ item.path | basename }} > /sys/bus/rbd/remove_single_major"
+      with_items: "{{ rbd_mapped_ids.files }}"
 
     - name: unload ceph kernel modules
       modprobe: