Describe the problem/challenge you have
a successful or unsuccessful run of ci/ci-test.sh leaves the temporary file /tmp/disk.img, a loopback device /dev/loopN, and a volume group lvmvg present on the host. This may be an issue when running ci tests locally.
Describe the solution you'd like
Add an exit handler to ci/ci-test.sh which cleans up generated resources from the system:
sudo pvcreate "$disk"
sudo vgcreate lvmvg "$disk"
# -------------------- Addition --------------------
# Clean this stuff up on termination
cleanup() {
echo "Exiting: Cleaning up test resources"
sudo vgremove lvmvg
sudo pvremove "$disk"
sudo losetup -d "${disk}"
rm /tmp/disk.img
}
trap cleanup EXIT
# -------------------- /Addition --------------------
# install snapshot and thin volume module for lvm
sudo modprobe dm-snapshot
Environment:
LVM Driver version: 2.03.22(2) (2023-08-02)
Cloud provider or hardware configuration: Local development machine
Describe the problem/challenge you have a successful or unsuccessful run of
ci/ci-test.sh
leaves the temporary file/tmp/disk.img
, a loopback device/dev/loopN
, and a volume grouplvmvg
present on the host. This may be an issue when running ci tests locally.Describe the solution you'd like Add an exit handler to
ci/ci-test.sh
which cleans up generated resources from the system:Environment:
/etc/os-release
): Arch Linux