switch: resolve device path so we can umount the osd data dir

If we don't do this, umounting devices declared like this
/dev/disk/by-id/ata-QEMU_HARDDISK_QM00001

will fail like:

umount: /dev/disk/by-id/ata-QEMU_HARDDISK_QM000011: mountpoint not found

Since we append '1' (partition 1), this won't work.
So we need to resolved the link to get something like /dev/sdb and then
append 1 to /dev/sdb1

Signed-off-by: Sébastien Han <seb@redhat.com>
Co-authored-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/2544/merge
Sébastien Han 2018-04-19 14:45:03 +02:00 committed by Guillaume Abrioux
parent 767abb5de0
commit 5fa92804f9
1 changed files with 8 additions and 2 deletions

View File

@ -258,12 +258,18 @@
with_items: "{{ devices }}" with_items: "{{ devices }}"
register: osd_running register: osd_running
- name: resolve device(s) path(s)
command: readlink -f {{ item }}
changed_when: false
with_items: "{{ devices }}"
register: devices_canonicalize
- name: unmount all the osd directories - name: unmount all the osd directories
command: umount "{{ item.0 }}"1 command: umount "{{ item.0.stdout }}"1
changed_when: false changed_when: false
failed_when: false failed_when: false
with_together: with_together:
- "{{ devices }}" - "{{ devices_canonicalize.results }}"
- "{{ osd_running.results }}" - "{{ osd_running.results }}"
when: when:
- item.1.get("rc", 0) != 0 - item.1.get("rc", 0) != 0