From d57f2fad861ac7cfde04c49865f62edf7bbe2ff4 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 6 Sep 2018 10:55:31 -0400 Subject: [PATCH] ceph-volume lvm.api use double -f flags when calling pvremove Fairly destructive, just like everything else when zapping a device. This is required in the case of double UUIDs detected, something that surfaced when testing with a loop device to create an nvme (the loop device ends up with the same UUID as the nvme). Signed-off-by: Alfredo Deza (cherry picked from commit c1cbc407c095e0bc3e25a8ff1519b4909ec519cc) --- src/ceph-volume/ceph_volume/api/lvm.py | 13 ++++++++++++- .../batch/centos7/bluestore/single-type/setup.yml | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) create mode 120000 src/ceph-volume/ceph_volume/tests/functional/batch/centos7/bluestore/single-type/setup.yml diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index e766671b3238c..8c09f09ee1764 100644 --- a/src/ceph-volume/ceph_volume/api/lvm.py +++ b/src/ceph-volume/ceph_volume/api/lvm.py @@ -477,7 +477,17 @@ def remove_vg(vg_name): def remove_pv(pv_name): """ - Removes a physical volume. + Removes a physical volume using a double `-f` to prevent prompts and fully + remove anything related to LVM. This is tremendously destructive, but so is all other actions + when zapping a device. + + In the case where multiple PVs are found, it will ignore that fact and + continue with the removal, specifically in the case of messages like:: + + WARNING: PV $UUID /dev/DEV-1 was already found on /dev/DEV-2 + + These situations can be avoided with custom filtering rules, which this API + cannot handle while accommodating custom user filters. """ fail_msg = "Unable to remove vg %s" % pv_name process.run( @@ -485,6 +495,7 @@ def remove_pv(pv_name): 'pvremove', '-v', # verbose '-f', # force it + '-f', # force it pv_name ], fail_msg=fail_msg, diff --git a/src/ceph-volume/ceph_volume/tests/functional/batch/centos7/bluestore/single-type/setup.yml b/src/ceph-volume/ceph_volume/tests/functional/batch/centos7/bluestore/single-type/setup.yml new file mode 120000 index 0000000000000..30874dfbb95b3 --- /dev/null +++ b/src/ceph-volume/ceph_volume/tests/functional/batch/centos7/bluestore/single-type/setup.yml @@ -0,0 +1 @@ +../../../playbooks/noop.yml \ No newline at end of file -- 2.39.5