From a77c066f1cd39cd68c11ea0b3a4e9e4bef01e0c6 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Tue, 13 Nov 2018 16:05:32 -0500 Subject: [PATCH] ceph-volume tests.functional.lvm test full removal of LVs Signed-off-by: Alfredo Deza (cherry picked from commit 4656bf0e333a50e0fca5fd0612cdda98ab5d70f9) --- .../lvm/playbooks/test_bluestore.yml | 43 ++++++++++++++++++- .../lvm/playbooks/test_filestore.yml | 43 ++++++++++++++++++- 2 files changed, 82 insertions(+), 4 deletions(-) diff --git a/src/ceph-volume/ceph_volume/tests/functional/lvm/playbooks/test_bluestore.yml b/src/ceph-volume/ceph_volume/tests/functional/lvm/playbooks/test_bluestore.yml index 7f4e109f3d4f..e4e804a709b5 100644 --- a/src/ceph-volume/ceph_volume/tests/functional/lvm/playbooks/test_bluestore.yml +++ b/src/ceph-volume/ceph_volume/tests/functional/lvm/playbooks/test_bluestore.yml @@ -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 @@ -60,3 +60,42 @@ 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 diff --git a/src/ceph-volume/ceph_volume/tests/functional/lvm/playbooks/test_filestore.yml b/src/ceph-volume/ceph_volume/tests/functional/lvm/playbooks/test_filestore.yml index 6cb3ac9ef19d..4aa3cf19d2ea 100644 --- a/src/ceph-volume/ceph_volume/tests/functional/lvm/playbooks/test_filestore.yml +++ b/src/ceph-volume/ceph_volume/tests/functional/lvm/playbooks/test_filestore.yml @@ -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 @@ -74,3 +74,42 @@ 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 -- 2.47.3