Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*~
.*.swp
.vagrant/
33 changes: 33 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end

config.vm.provider "libvirt" do |lv|
lv.memory = "1024"
end


config.vm.define "target_c7" do |target_c7|
target_c7.vm.box = "centos/7"
end

config.vm.define "target_c6" do |target_c6|
target_c6.vm.box = "centos/6"
end

#C5 is EOL
#config.vm.define "target_c5" do |target_c5|
# target_c5.vm.box = "centos/5"
#end

config.vm.provision "shell", inline: <<-SHELL
yum -y update
yum -y install vim-enhanced emacs-nox nano
SHELL

end
5 changes: 5 additions & 0 deletions tests/p_lvm2/00-install-lvm2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# Author: Athmane Madjoudj <athmane@fedoraproject.org>

# Should be installed by default
t_InstallPackage lvm2
18 changes: 18 additions & 0 deletions tests/p_lvm2/01-setup_lo_devs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Author: Athmane Madjoudj <athmane@fedoraproject.org>

t_Log "Running $0 - setting up loopback devices for LVM tests."

# We need a fixed path for the other tests to avoid exporting variables

#img_temp_dir=`mktemp -d /tmp/img_temp_dir.XXXXXXXXXX`
img_temp_dir="/tmp/t_lvm_temp_dir"

# Create few disk images and loopback devices
mkdir -p $img_temp_dir
for i in `seq 0 4` ; do
dd if=/dev/zero of=$img_temp_dir/disk${i}.img bs=64K count=8192
losetup -f $img_temp_dir/disk${i}.img
done

t_CheckExitStatus $?
10 changes: 10 additions & 0 deletions tests/p_lvm2/05-test-lvm2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
# Author: Athmane Madjoudj <athmane@fedoraproject.org>

t_Log "Running $0 - Basic LVM tests."

pvs &&\
vgs &&\
lvs

t_CheckExitStatus $?
18 changes: 18 additions & 0 deletions tests/p_lvm2/06-create-new-vg-lv-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Author: Athmane Madjoudj <athmane@fedoraproject.org>

t_Log "Running $0 - Create new Volume Group and Logical volume tests"


disk0=`losetup -a | grep t_lvm_temp_dir/disk0.img | cut -d: -f1`

pvcreate $disk0 && \
vgcreate vg_t_lvm $disk0 &&\
lvcreate -n lv_t_lvm_test -L 200m vg_t_lvm &&\
mkfs.ext4 /dev/vg_t_lvm/lv_t_lvm_test &&\
mkdir /mnt/t_lvm_test &&\
mount /dev/vg_t_lvm/lv_t_lvm_test /mnt/t_lvm_test &&\
touch /mnt/t_lvm_test/test


t_CheckExitStatus $?
16 changes: 16 additions & 0 deletions tests/p_lvm2/07-extend-vg-resize-lv-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# Author: Athmane Madjoudj <athmane@fedoraproject.org>

t_Log "Running $0 - Extend Volume Group and resize Logical volume tests"


disk1=`losetup -a | grep t_lvm_temp_dir/disk1.img | cut -d: -f1`

pvcreate $disk1 &&\
vgextend vg_t_lvm $disk1 &&\
lvresize -L +600m /dev/vg_t_lvm/lv_t_lvm_test &&\
resize2fs /dev/vg_t_lvm/lv_t_lvm_test &&\
touch /mnt/t_lvm_test/test &&\
umount /mnt/t_lvm_test

t_CheckExitStatus $?
17 changes: 17 additions & 0 deletions tests/p_lvm2/08-pvmove-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# Author: Athmane Madjoudj <athmane@fedoraproject.org>

t_Log "Running $0 - Move PEs from a PV to another test."


disk0=`losetup -a | grep t_lvm_temp_dir/disk0.img | cut -d: -f1`
disk2=`losetup -a | grep t_lvm_temp_dir/disk2.img | cut -d: -f1`

pvcreate $disk2 &&\
vgextend vg_t_lvm $disk2 &&\
pvmove $disk0 $disk2 &&\
mount /dev/vg_t_lvm/lv_t_lvm_test /mnt/t_lvm_test &&\
touch /mnt/t_lvm_test/test &&\
umount /mnt/t_lvm_test

t_CheckExitStatus $?
21 changes: 21 additions & 0 deletions tests/p_lvm2/09-create-new-mirrored-lv-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Author: Athmane Madjoudj <athmane@fedoraproject.org>

t_Log "Running $0 - Create new Volume Group and Mirrored Logical volume tests"


disk3=`losetup -a | grep t_lvm_temp_dir/disk3.img | cut -d: -f1`
disk4=`losetup -a | grep t_lvm_temp_dir/disk4.img | cut -d: -f1`

pvcreate $disk3 && \
pvcreate $disk4 && \
vgcreate vg_t_lvm_mirror $disk3 $disk4 &&\
lvcreate -m1 -L 300m -n lv_mirror_test vg_t_lvm_mirror
mkfs.ext4 /dev/vg_t_lvm_mirror/lv_mirror_test &&\
mkdir /mnt/t_lvm_mirror &&\
mount /dev/vg_t_lvm_mirror/lv_mirror_test /mnt/t_lvm_mirror &&\
touch /mnt/t_lvm_mirror/test &&\
umount /mnt/t_lvm_mirror


t_CheckExitStatus $?
22 changes: 22 additions & 0 deletions tests/p_lvm2/99-lvm-tests-cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# Author: Athmane Madjoudj <athmane@fedoraproject.org>

t_Log "Running $0 - Remove LV/VG/PV tests"


disk0=`losetup -a | grep t_lvm_temp_dir/disk0.img | cut -d: -f1`
disk1=`losetup -a | grep t_lvm_temp_dir/disk1.img | cut -d: -f1`
disk2=`losetup -a | grep t_lvm_temp_dir/disk2.img | cut -d: -f1`
disk3=`losetup -a | grep t_lvm_temp_dir/disk3.img | cut -d: -f1`
disk4=`losetup -a | grep t_lvm_temp_dir/disk4.img | cut -d: -f1`
all_disks="$disk0 $disk1 $disk2 $disk3 $disk4"

lvremove -f /dev/vg_t_lvm/lv_t_lvm_test && \
lvremove -f /dev/vg_t_lvm_mirror/lv_mirror_test && \
vgremove -f vg_t_lvm && \
vgremove -f vg_t_lvm_mirror && \
pvremove -fy $all_disks &&\
(for disk in $all_disks ; do losetup -d $disk ; done)


t_CheckExitStatus $?