]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume lvm.api use double -f flags when calling pvremove
authorAlfredo Deza <adeza@redhat.com>
Thu, 6 Sep 2018 14:55:31 +0000 (10:55 -0400)
committerAlfredo Deza <adeza@redhat.com>
Thu, 6 Sep 2018 20:37:36 +0000 (16:37 -0400)
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 <adeza@redhat.com>
(cherry picked from commit c1cbc407c095e0bc3e25a8ff1519b4909ec519cc)

src/ceph-volume/ceph_volume/api/lvm.py
src/ceph-volume/ceph_volume/tests/functional/batch/centos7/bluestore/single-type/setup.yml [new symlink]

index e766671b3238c0feb18b8ccb2255825b4fd7f105..8c09f09ee176491049e9f760966e1ed5b196fb36 100644 (file)
@@ -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 (symlink)
index 0000000..30874df
--- /dev/null
@@ -0,0 +1 @@
+../../../playbooks/noop.yml
\ No newline at end of file