]> git-server-git.apps.pok.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)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 17 Aug 2020 07:28:12 +0000 (09:28 +0200)
This way we keep consistency with purge-container-cluster.yml playbook.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
infrastructure-playbooks/purge-cluster.yml

index 5fe246bbab2a7d75b2f2ece5294081a146fa3e1b..6d523e2485f8ce78852b4f1bf1fb9c169a93e019 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: