From: David Galloway Date: Fri, 27 Apr 2018 16:37:02 +0000 (-0400) Subject: testnode: Redo LVM removal X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=fa031843ff08da469992bc171367b46ecc4afd47;p=ceph-cm-ansible.git testnode: Redo LVM removal For whatever reason, `dmsetup remove_all` fails on Bionic. As long as there are leftover lvs or vgs, a pv must be linked to them. We can just force remove the physical volume which wipes out the rest of the LVM data. Signed-off-by: David Galloway --- diff --git a/roles/testnode/tasks/zap_disks.yml b/roles/testnode/tasks/zap_disks.yml index 759fa11..9826161 100644 --- a/roles/testnode/tasks/zap_disks.yml +++ b/roles/testnode/tasks/zap_disks.yml @@ -64,46 +64,13 @@ ignore_errors: true ## See http://tracker.ceph.com/issues/21989 -## Following 6 tasks only get run if `dmsetup remove_all` fails -- name: Check for logical volumes - shell: "lvdisplay | grep 'LV Path' | awk '{ print $3 }'" - register: lvs_to_remove - when: removed_lvm_data|failed - -- name: Check for volume groups - shell: "vgdisplay | grep 'VG Name' | awk '{ print $3 }'" - register: vgs_to_remove - when: removed_lvm_data|failed - - name: Check for physical volumes shell: "pvdisplay | grep 'PV Name' | awk '{ print $3 }'" register: pvs_to_remove - when: removed_lvm_data|failed - -# The lvol ansible module is not used here because the vg name is required and that'd get messy -- name: Remove logical volumes - shell: "lvremove --force {{ item }}" - with_items: "{{ lvs_to_remove.stdout_lines }}" - when: - - removed_lvm_data|failed - - lvs_to_remove is defined - - lvs_to_remove.stdout_lines|length > 0 - -- name: Remove volume groups - lvg: - vg: "{{ item }}" - state: absent - force: yes - with_items: "{{ vgs_to_remove.stdout_lines }}" - when: - - removed_lvm_data|failed - - vgs_to_remove is defined - - vgs_to_remove.stdout_lines|length > 0 - name: Remove physical volumes - shell: "pvremove --force {{ item }}" + shell: "pvremove --force --force --yes {{ item }}" with_items: "{{ pvs_to_remove.stdout_lines }}" when: - - removed_lvm_data|failed - pvs_to_remove is defined - pvs_to_remove.stdout_lines|length > 0