]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume tests.functional.lvm test full removal of LVs
authorAlfredo Deza <adeza@redhat.com>
Tue, 13 Nov 2018 21:05:32 +0000 (16:05 -0500)
committerAlfredo Deza <adeza@redhat.com>
Wed, 14 Nov 2018 18:24:09 +0000 (13:24 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 4656bf0e333a50e0fca5fd0612cdda98ab5d70f9)

src/ceph-volume/ceph_volume/tests/functional/lvm/playbooks/test_bluestore.yml
src/ceph-volume/ceph_volume/tests/functional/lvm/playbooks/test_filestore.yml

index 7f4e109f3d4f1df96027cf07694ed6a6f2513bf0..e4e804a709b54f35b2c15c3c7260ff350d581bd2 100644 (file)
@@ -40,9 +40,9 @@
       environment:
         CEPH_VOLUME_DEBUG: 1
 
-    # osd.0 device
+    # osd.0 device (zap without --destroy that removes the LV)
     - name: zap test_group/data-lv1
-      command: "ceph-volume --cluster {{ cluster }} lvm zap --destroy test_group/data-lv1"
+      command: "ceph-volume --cluster {{ cluster }} lvm zap test_group/data-lv1"
       environment:
         CEPH_VOLUME_DEBUG: 1
 
       command: "ceph-volume lvm list"
       environment:
         CEPH_VOLUME_DEBUG: 1
+
+    - name: create temporary directory
+      tempfile:
+        state: directory
+        suffix: sparse
+      register: tmpdir
+
+    - name: create a 5GB sparse file
+      command: fallocate -l 5G {{ tmpdir.path }}/sparse.file
+
+    - name: find an empty loop device
+      command: losetup -f
+      register: losetup_list
+
+    - name: setup loop device with sparse file
+      command: losetup {{ losetup_list.stdout }} {{ tmpdir.path }}/sparse.file
+
+    - name: create volume group
+      command: vgcreate test_zap {{ losetup_list.stdout }}
+      failed_when: false
+
+    - name: create logical volume 1
+      command: lvcreate --yes -l 50%FREE -n data-lv1 test_zap
+      failed_when: false
+
+    - name: create logical volume 2
+      command: lvcreate --yes -l 50%FREE -n data-lv2 test_zap
+      failed_when: false
+
+    # zapping the first lv shouldn't remove the vg, allowing the second zap to succeed
+    - name: zap test_zap/data-lv1
+      command: "ceph-volume --cluster {{ cluster }} lvm zap --destroy test_zap/data-lv1"
+      environment:
+        CEPH_VOLUME_DEBUG: 1
+
+    - name: zap test_zap/data-lv2
+      command: "ceph-volume --cluster {{ cluster }} lvm zap --destroy test_zap/data-lv2"
+      environment:
+        CEPH_VOLUME_DEBUG: 1
index 6cb3ac9ef19d8bed124d15e37afa566fc0cc7fd7..4aa3cf19d2ea8c79af558d09cdc472e0d9e3cdbd 100644 (file)
@@ -54,9 +54,9 @@
       environment:
         CEPH_VOLUME_DEBUG: 1
 
-    # osd.0 journal device
+    # osd.0 journal device (zap without --destroy that removes the LV)
     - name: zap /dev/sdc1
-      command: "ceph-volume --cluster {{ cluster }} lvm zap /dev/sdc1 --destroy"
+      command: "ceph-volume --cluster {{ cluster }} lvm zap /dev/sdc1"
       environment:
         CEPH_VOLUME_DEBUG: 1
 
       command: "ceph-volume lvm list"
       environment:
         CEPH_VOLUME_DEBUG: 1
+
+    - name: create temporary directory
+      tempfile:
+        state: directory
+        suffix: sparse
+      register: tmpdir
+
+    - name: create a 5GB sparse file
+      command: fallocate -l 5G {{ tmpdir.path }}/sparse.file
+
+    - name: find an empty loop device
+      command: losetup -f
+      register: losetup_list
+
+    - name: setup loop device with sparse file
+      command: losetup {{ losetup_list.stdout }} {{ tmpdir.path }}/sparse.file
+
+    - name: create volume group
+      command: vgcreate test_zap {{ losetup_list.stdout }}
+      failed_when: false
+
+    - name: create logical volume 1
+      command: lvcreate --yes -l 50%FREE -n data-lv1 test_zap
+      failed_when: false
+
+    - name: create logical volume 2
+      command: lvcreate --yes -l 50%FREE -n data-lv2 test_zap
+      failed_when: false
+
+    # zapping the first lv shouldn't remove the vg, allowing the second zap to succeed
+    - name: zap test_zap/data-lv1
+      command: "ceph-volume --cluster {{ cluster }} lvm zap --destroy test_zap/data-lv1"
+      environment:
+        CEPH_VOLUME_DEBUG: 1
+
+    - name: zap test_zap/data-lv2
+      command: "ceph-volume --cluster {{ cluster }} lvm zap --destroy test_zap/data-lv2"
+      environment:
+        CEPH_VOLUME_DEBUG: 1