From 851a89b8fc8452d9a7fe881c0fc4e83f430d3246 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 4 Aug 2020 17:29:41 +0200 Subject: [PATCH] purge-cluster: use sysfs method for unmapping rbd devices This way we keep consistency with purge-container-cluster.yml playbook. Signed-off-by: Guillaume Abrioux (cherry picked from commit f77fa6e2a4d4c2b4522582f53713c2e49fecbe12) --- infrastructure-playbooks/purge-cluster.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index 576307937..d673e925f 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -88,15 +88,15 @@ - 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: find mapped rbd ids + find: + paths: /sys/bus/rbd/devices + file_type: any + register: rbd_mapped_ids - - name: ensure rbd devices are unmapped - command: rbdmap unmap-all - when: command_rbdmap.rc == 0 + - 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: