|
|
From 249118233b47afa7f17c0777b79195e5453e98b3 Mon Sep 17 00:00:00 2001
|
|
|
From: Jan Tulak <jtulak@redhat.com>
|
|
|
Date: Wed, 17 Apr 2019 11:43:05 +0200
|
|
|
Subject: [PATCH 5/9] bashtests: remove btrfs tests
|
|
|
|
|
|
Btrfs is not in RHEL8, there is no sense in testing it on CI, so let's
|
|
|
remove all btrfs related tests.
|
|
|
|
|
|
Signed-off-by: Jan Tulak <jtulak@redhat.com>
|
|
|
---
|
|
|
tests/bashtests/006-btrfs-add.sh | 106 ---------------
|
|
|
tests/bashtests/007-btrfs-create.sh | 178 --------------------------
|
|
|
tests/bashtests/008-btrfs-remove.sh | 161 -----------------------
|
|
|
tests/bashtests/010-btrfs-snapshot.sh | 135 -------------------
|
|
|
tests/bashtests/018-migrate.sh | 96 --------------
|
|
|
5 files changed, 676 deletions(-)
|
|
|
delete mode 100755 tests/bashtests/006-btrfs-add.sh
|
|
|
delete mode 100755 tests/bashtests/007-btrfs-create.sh
|
|
|
delete mode 100755 tests/bashtests/008-btrfs-remove.sh
|
|
|
delete mode 100755 tests/bashtests/010-btrfs-snapshot.sh
|
|
|
|
|
|
diff --git a/tests/bashtests/006-btrfs-add.sh b/tests/bashtests/006-btrfs-add.sh
|
|
|
deleted file mode 100755
|
|
|
index f0b6556..0000000
|
|
|
--- a/tests/bashtests/006-btrfs-add.sh
|
|
|
+++ /dev/null
|
|
|
@@ -1,106 +0,0 @@
|
|
|
-#!/bin/bash
|
|
|
-#
|
|
|
-# (C)2012 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
|
|
-#
|
|
|
-# This program is free software: you can redistribute it and/or modify
|
|
|
-# it under the terms of the GNU General Public License as published by
|
|
|
-# the Free Software Foundation, either version 2 of the License, or
|
|
|
-# (at your option) any later version.
|
|
|
-#
|
|
|
-# This program is distributed in the hope that it will be useful,
|
|
|
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
-# GNU General Public License for more details.
|
|
|
-#
|
|
|
-# You should have received a copy of the GNU General Public License
|
|
|
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
-
|
|
|
-export test_name='006-btrfs-add'
|
|
|
-test_description='Exercise ssm add with btrfs backend'
|
|
|
-
|
|
|
-. lib/test
|
|
|
-
|
|
|
-DEV_COUNT=10
|
|
|
-DEV_SIZE=300
|
|
|
-TEST_MAX_SIZE=$(($DEV_COUNT*$DEV_SIZE))
|
|
|
-aux prepare_devs $DEV_COUNT $DEV_SIZE
|
|
|
-aux prepare_mnts 10
|
|
|
-TEST_DEVS=$(cat DEVICES)
|
|
|
-export SSM_DEFAULT_BACKEND='btrfs'
|
|
|
-export SSM_BTRFS_DEFAULT_POOL=$vg1
|
|
|
-export VOL_PREFIX="vol"
|
|
|
-export SSM_NONINTERACTIVE='1'
|
|
|
-vol1=${VOL_PREFIX}001
|
|
|
-vol2=${VOL_PREFIX}002
|
|
|
-vol3=${VOL_PREFIX}003
|
|
|
-
|
|
|
-pool1=$vg2
|
|
|
-pool2=$vg3
|
|
|
-
|
|
|
-# Create default pool with all devices at once
|
|
|
-ssm add $TEST_DEVS
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $DEV_COUNT
|
|
|
-check list_table "$(ssm list pool)" $SSM_BTRFS_DEFAULT_POOL btrfs 10 none none none
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Specify backend
|
|
|
-ssm -b btrfs add $TEST_DEVS
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $DEV_COUNT
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-export SSM_DEFAULT_BACKEND='lvm'
|
|
|
-ssm --backend btrfs add $TEST_DEVS
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $DEV_COUNT
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-export SSM_DEFAULT_BACKEND='btrfs'
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-ssm add $TEST_DEVS
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $DEV_COUNT
|
|
|
-check list_table "$(ssm list pool)" $SSM_BTRFS_DEFAULT_POOL btrfs $DEV_COUNT none none none
|
|
|
-ssm remove $dev1 $dev2 $dev3
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $(($DEV_COUNT-3))
|
|
|
-ssm remove $dev4
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $(($DEV_COUNT-4))
|
|
|
-check list_table "$(ssm list pool)" $SSM_BTRFS_DEFAULT_POOL btrfs $(($DEV_COUNT-4)) none none none
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Create default pool by adding devices one per a call
|
|
|
-for i in $TEST_DEVS; do
|
|
|
- ssm add $i
|
|
|
-done
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $DEV_COUNT
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Create different groups from different devices
|
|
|
-ssm add $dev4
|
|
|
-ssm add $dev1 $dev2 $dev3 -p $pool1
|
|
|
-ssm add --pool $pool2 $dev7 $dev8
|
|
|
-ssm add $dev5 $dev6
|
|
|
-not ssm add $dev5 $dev6 $dev1 -p $pool1
|
|
|
-ssm add $dev9 $dev1 -p $pool1
|
|
|
-ssm add $dev10 -p $pool2
|
|
|
-not ssm add $dev10 -p $pool1
|
|
|
-not ssm add $dev10 $pool2 -p $pool1
|
|
|
-
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count 3
|
|
|
-check btrfs_fs_field $pool1 dev_count 4
|
|
|
-check btrfs_fs_field $pool2 dev_count 3
|
|
|
-ssm_output=$(ssm list pool)
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL btrfs 3 none none none
|
|
|
-check list_table "$ssm_output" $pool1 btrfs 4 none none none
|
|
|
-check list_table "$ssm_output" $pool2 btrfs 3 none none none
|
|
|
-
|
|
|
-ssm -f remove --all
|
|
|
-
|
|
|
-ssm add --help
|
|
|
-
|
|
|
-# Some cases which should fail
|
|
|
-not ssm _garbage_
|
|
|
-not ssm add
|
|
|
-not ssm add _garbage_
|
|
|
-not ssm add $dev1 ${dev1}not_exist
|
|
|
-not check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL label $SSM_BTRFS_DEFAULT_POOL
|
|
|
-not ssm add _somepool
|
|
|
-not ssm add $dev1 $dev2 $dev3 -p $pool1 _otherpool
|
|
|
diff --git a/tests/bashtests/007-btrfs-create.sh b/tests/bashtests/007-btrfs-create.sh
|
|
|
deleted file mode 100755
|
|
|
index 162b7b2..0000000
|
|
|
--- a/tests/bashtests/007-btrfs-create.sh
|
|
|
+++ /dev/null
|
|
|
@@ -1,178 +0,0 @@
|
|
|
-#!/bin/bash
|
|
|
-#
|
|
|
-# (C)2012 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
|
|
-#
|
|
|
-# This program is free software: you can redistribute it and/or modify
|
|
|
-# it under the terms of the GNU General Public License as published by
|
|
|
-# the Free Software Foundation, either version 2 of the License, or
|
|
|
-# (at your option) any later version.
|
|
|
-#
|
|
|
-# This program is distributed in the hope that it will be useful,
|
|
|
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
-# GNU General Public License for more details.
|
|
|
-#
|
|
|
-# You should have received a copy of the GNU General Public License
|
|
|
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
-
|
|
|
-export test_name='007-btrfs-create'
|
|
|
-test_description='Exercise ssm create command with btrfs backend'
|
|
|
-
|
|
|
-. lib/test
|
|
|
-
|
|
|
-DEV_COUNT=10
|
|
|
-DEV_SIZE=300
|
|
|
-TEST_MAX_SIZE=$(($DEV_COUNT*$DEV_SIZE))
|
|
|
-aux prepare_devs $DEV_COUNT $DEV_SIZE
|
|
|
-aux prepare_mnts 10
|
|
|
-TEST_DEVS=$(cat DEVICES)
|
|
|
-export SSM_DEFAULT_BACKEND='btrfs'
|
|
|
-export SSM_BTRFS_DEFAULT_POOL=$vg1
|
|
|
-export VOL_PREFIX="vol"
|
|
|
-export SSM_NONINTERACTIVE='1'
|
|
|
-vol1=${VOL_PREFIX}001
|
|
|
-vol2=${VOL_PREFIX}002
|
|
|
-vol3=${VOL_PREFIX}003
|
|
|
-
|
|
|
-pool1=$vg2
|
|
|
-pool2=$vg3
|
|
|
-
|
|
|
-dehumanise() {
|
|
|
- for v in "${@:-$(</dev/stdin)}"
|
|
|
- do
|
|
|
- echo $v | awk \
|
|
|
- 'BEGIN{IGNORECASE = 1}
|
|
|
- function printpower(n,b,p) {printf "%u\n", n*b^p; next}
|
|
|
- /[0-9]$/{print $1;next};
|
|
|
- /K(iB)?$/{printpower($1, 2, 10)};
|
|
|
- /M(iB)?$/{printpower($1, 2, 20)};
|
|
|
- /G(iB)?$/{printpower($1, 2, 30)};
|
|
|
- /T(iB)?$/{printpower($1, 2, 40)};
|
|
|
- /KB$/{ printpower($1, 10, 3)};
|
|
|
- /MB$/{ printpower($1, 10, 6)};
|
|
|
- /GB$/{ printpower($1, 10, 9)};
|
|
|
- /TB$/{ printpower($1, 10, 12)}'
|
|
|
- done
|
|
|
-}
|
|
|
-# Create volume with all devices at once
|
|
|
-ssm create $TEST_DEVS $mnt1
|
|
|
-not ssm create $TEST_DEVS -p $pool1
|
|
|
-
|
|
|
-# List and see if Free + Used == Total (allow 5 percent difference for rounding)
|
|
|
-ssm list pools
|
|
|
-test 1 -eq "$(dehumanise `ssm list pools | grep SSMTEST | awk '{print $4 $5 " " $6 $7 " " $8 $9}'` | paste - - - | awk '{print (($1 + $2 - $3) < (0.05 * $3))}')"
|
|
|
-
|
|
|
-#Create subvolume with nonexisting path
|
|
|
-not ssm create -n $vol1/$vol2
|
|
|
-
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $DEV_COUNT
|
|
|
-check list_table "$(ssm list vol)" $SSM_BTRFS_DEFAULT_POOL $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1
|
|
|
-ssm create
|
|
|
-ssm create --name $vol1
|
|
|
-ssm create --name $vol1/$vol2
|
|
|
-check btrfs_vol_field $mnt1 vol_count 3
|
|
|
-check btrfs_vol_field $mnt1 subvolume $vol1
|
|
|
-check btrfs_vol_field $mnt1 subvolume $vol1/$vol2
|
|
|
-ssm_output=$(ssm list vol)
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:....-..-..-....... $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1/....-..-..-.......
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$vol1 $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1/$vol1
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$vol1/$vol2 $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1/$vol1/$vol2
|
|
|
-umount $mnt1
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Create volume with just one device
|
|
|
-ssm create $dev1
|
|
|
-not ssm create $dev1 -p $pool1
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Specify backend
|
|
|
-ssm --backend btrfs create $dev1
|
|
|
-not ssm create $dev1 -p $pool1
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-export SSM_DEFAULT_BACKEND='lvm'
|
|
|
-ssm -b btrfs create $dev1
|
|
|
-not ssm create $dev1 -p $pool1
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-export SSM_DEFAULT_BACKEND='btrfs'
|
|
|
-
|
|
|
-# Create raid 0 volume with just one device
|
|
|
-ssm create -r 0 $dev1 $dev2 $dev3 $dev4
|
|
|
-not ssm create $dev1 -p $pool1
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Create raid 1 volume with just one device
|
|
|
-ssm create -r 1 $dev1 $dev2 $dev3 $dev4
|
|
|
-not ssm create $dev1 -p $pool1
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Create raid 10 volume with just one device
|
|
|
-ssm create -r 10 $dev1 $dev2 $dev3 $dev4
|
|
|
-ssm check $SSM_BTRFS_DEFAULT_POOL
|
|
|
-not ssm create $dev1 -p $pool1
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Create several volumes with several pools
|
|
|
-ssm create $dev1 $mnt1
|
|
|
-ssm create --name $vol1
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count 1
|
|
|
-check btrfs_vol_field $mnt1 subvolume $vol1
|
|
|
-
|
|
|
-ssm create --pool $pool1 $dev2 $dev3 $mnt2
|
|
|
-ssm create --name $vol2 --pool $pool1
|
|
|
-# Also try to mount the subvolume somewhere else
|
|
|
-ssm create --name $vol3 --pool $pool1 $mnt3
|
|
|
-check btrfs_fs_field $pool1 dev_count 2
|
|
|
-check btrfs_vol_field $mnt2 subvolume $vol2
|
|
|
-check btrfs_vol_field $mnt1 vol_count 1
|
|
|
-check btrfs_vol_field $mnt2 vol_count 2
|
|
|
-not check btrfs_vol_field $mnt2 subvolume $vol1
|
|
|
-
|
|
|
-ssm create --name $vol1 --pool $pool2 $dev4 $dev5 $dev6
|
|
|
-check btrfs_fs_field $pool2 dev_count 3
|
|
|
-ssm create --name $vol2 --pool $pool2 $dev7 $dev8
|
|
|
-ssm create --name $vol1 --pool $pool2 $dev9 $mnt4
|
|
|
-check btrfs_fs_field $pool2 dev_count 6
|
|
|
-check btrfs_vol_field $mnt2 subvolume $vol2
|
|
|
-check btrfs_vol_field $mnt4 subvolume $vol1
|
|
|
-check btrfs_vol_field $mnt2 vol_count 2
|
|
|
-check btrfs_vol_field $mnt4 vol_count 2
|
|
|
-not check btrfs_vol_field $mnt2 subvolume $vol1
|
|
|
-ssm_output=$(ssm list vol)
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$vol1 $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1/$vol1
|
|
|
-check list_table "$ssm_output" $pool1 $pool1 none btrfs none none btrfs $mnt2
|
|
|
-check list_table "$ssm_output" $pool1:$vol2 $pool1 none btrfs none none btrfs $mnt2/$vol2
|
|
|
-check list_table "$ssm_output" $pool1:$vol3 $pool1 none btrfs none none btrfs $mnt3
|
|
|
-check list_table "$ssm_output" $pool2 $pool2 none btrfs none none btrfs
|
|
|
-check list_table "$ssm_output" $pool2:$vol1 $pool2 none btrfs none none btrfs $mnt4
|
|
|
-check list_table "$ssm_output" $pool2:$vol2 $pool2 none btrfs none none btrfs
|
|
|
-ssm_output=$(ssm list pool)
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL btrfs 1 none none none
|
|
|
-check list_table "$ssm_output" $pool1 btrfs 2 none none none
|
|
|
-check list_table "$ssm_output" $pool2 btrfs 6 none none none
|
|
|
-
|
|
|
-umount_all
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL $pool1 $pool2
|
|
|
-
|
|
|
-# Create root mounted soubvolume and then another subvolume mounted at different mount point
|
|
|
-ssm create $TEST_DEVS $mnt1
|
|
|
-ssm create --name $vol1 $mnt2
|
|
|
-ssm create --name $vol1/$vol2 $mnt3
|
|
|
-
|
|
|
-# Create subvolume with already existing path
|
|
|
-not ssm create --name $vol1/$vol2
|
|
|
-not ssm create --name $vol1 $mnt3
|
|
|
-ssm_output=$(ssm list vol)
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$vol1 $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt2
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$vol1/$vol2 $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt3
|
|
|
-umount_all
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-ssm create --help
|
|
|
-
|
|
|
-# Some cases which should fail
|
|
|
-not ssm create
|
|
|
-not ssm -f remove --all
|
|
|
diff --git a/tests/bashtests/008-btrfs-remove.sh b/tests/bashtests/008-btrfs-remove.sh
|
|
|
deleted file mode 100755
|
|
|
index 705a76d..0000000
|
|
|
--- a/tests/bashtests/008-btrfs-remove.sh
|
|
|
+++ /dev/null
|
|
|
@@ -1,161 +0,0 @@
|
|
|
-#!/bin/bash
|
|
|
-#
|
|
|
-# (C)2012 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
|
|
-#
|
|
|
-# This program is free software: you can redistribute it and/or modify
|
|
|
-# it under the terms of the GNU General Public License as published by
|
|
|
-# the Free Software Foundation, either version 2 of the License, or
|
|
|
-# (at your option) any later version.
|
|
|
-#
|
|
|
-# This program is distributed in the hope that it will be useful,
|
|
|
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
-# GNU General Public License for more details.
|
|
|
-#
|
|
|
-# You should have received a copy of the GNU General Public License
|
|
|
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
-
|
|
|
-export test_name='008-btrfs-remove'
|
|
|
-test_description='Exercise ssm remove command with btrfs backend'
|
|
|
-
|
|
|
-. lib/test
|
|
|
-
|
|
|
-DEV_COUNT=10
|
|
|
-DEV_SIZE=300
|
|
|
-TEST_MAX_SIZE=$(($DEV_COUNT*$DEV_SIZE))
|
|
|
-aux prepare_devs $DEV_COUNT $DEV_SIZE
|
|
|
-aux prepare_mnts 10
|
|
|
-TEST_DEVS=$(cat DEVICES)
|
|
|
-export SSM_DEFAULT_BACKEND='btrfs'
|
|
|
-export SSM_BTRFS_DEFAULT_POOL=$vg1
|
|
|
-export VOL_PREFIX="vol"
|
|
|
-export SSM_NONINTERACTIVE='1'
|
|
|
-vol1=${VOL_PREFIX}001
|
|
|
-vol2=${VOL_PREFIX}002
|
|
|
-vol3=${VOL_PREFIX}003
|
|
|
-
|
|
|
-pool1=$vg2
|
|
|
-pool2=$vg3
|
|
|
-
|
|
|
-# Remove subvolume
|
|
|
-ssm create $TEST_DEVS
|
|
|
-ssm create --name $vol1
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL label $SSM_BTRFS_DEFAULT_POOL
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-not check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL label $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Remove volume group
|
|
|
-ssm create $TEST_DEVS $mnt1
|
|
|
-ssm create --name $vol1
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $DEV_COUNT
|
|
|
-check btrfs_vol_field $mnt1 subvolume $vol1
|
|
|
-ssm list
|
|
|
-ssm -f remove $mnt1/$vol1
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $DEV_COUNT
|
|
|
-not check btrfs_vol_field $mnt1 subvolume $vol1
|
|
|
-umount $mnt1
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Remove unused devices from the pool
|
|
|
-ssm create $dev1
|
|
|
-btrfs filesystem show
|
|
|
-ssm add $TEST_DEVS
|
|
|
-btrfs filesystem show
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count $DEV_COUNT
|
|
|
-# Skip first few devices, because btrfs is now in a raid mode
|
|
|
-# and won't allow us to delete the last few devices.
|
|
|
-# We only want to see if removal works, so deleting only some is ok.
|
|
|
-ssm -f remove $(echo $TEST_DEVS | cut -d' ' -f5-)
|
|
|
-btrfs filesystem show
|
|
|
-ssm list
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count 4
|
|
|
-ssm -f remove --all
|
|
|
-
|
|
|
-# Remove multiple things
|
|
|
-ssm add $dev1 $dev2 -p $pool1
|
|
|
-ssm create --pool $pool2 $dev3 $dev4 $mnt1
|
|
|
-ssm create --name $vol1 -p $pool2
|
|
|
-ssm create --name $vol1 $dev5 $dev6 $mnt3
|
|
|
-ssm create --name $vol2 $dev7 $dev8
|
|
|
-ssm add $dev9
|
|
|
-
|
|
|
-check btrfs_fs_field $pool1 dev_count 2
|
|
|
-check btrfs_fs_field $pool2 dev_count 2
|
|
|
-check btrfs_vol_field $mnt1 vol_count 1
|
|
|
-check btrfs_vol_field $mnt1 subvolume $vol1
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count 5
|
|
|
-check btrfs_vol_field $mnt3 vol_count 1
|
|
|
-check btrfs_vol_field $mnt3 subvolume $vol2
|
|
|
-
|
|
|
-ssm list
|
|
|
-
|
|
|
-export SSM_DEFAULT_BACKEND='lvm'
|
|
|
-ssm -f remove $pool1 ${pool2}:$vol1 $mnt3/$vol2 $dev9
|
|
|
-export SSM_DEFAULT_BACKEND='btrfs'
|
|
|
-
|
|
|
-not check btrfs_fs_field $pool1 label $pool1
|
|
|
-not check btrfs_vol_field $mnt1 subvolume $vol1
|
|
|
-not check btrfs_vol_field $mnt2 subvolume $vol2
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count 4
|
|
|
-umount_all
|
|
|
-ssm -f remove --all
|
|
|
-
|
|
|
-# Remove all
|
|
|
-ssm add $dev1 $dev2 -p $pool1
|
|
|
-ssm create --pool $pool2 $dev3 $dev4 $mnt1
|
|
|
-ssm create --name $vol1 -p $pool2
|
|
|
-ssm create --name $vol1 $dev5 $dev6 $mnt3
|
|
|
-ssm create --name $vol2 $dev7 $dev8
|
|
|
-ssm create --name $vol3 $mnt2
|
|
|
-ssm add $dev9
|
|
|
-
|
|
|
-# We can not remove mounted fs
|
|
|
-not ssm remove $pool2
|
|
|
-
|
|
|
-# We can not remove mounted subvolume
|
|
|
-not ssm remove ${SSM_BTRFS_DEFAULT_POOL}:${vol3}
|
|
|
-
|
|
|
-check btrfs_fs_field $pool1 dev_count 2
|
|
|
-check btrfs_fs_field $pool2 dev_count 2
|
|
|
-check btrfs_vol_field $mnt1 vol_count 1
|
|
|
-check btrfs_vol_field $mnt1 subvolume $vol1
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count 5
|
|
|
-check btrfs_vol_field $mnt3 vol_count 2
|
|
|
-check btrfs_vol_field $mnt3 subvolume $vol2
|
|
|
-check btrfs_vol_field $mnt2 subvolume $vol3
|
|
|
-
|
|
|
-# but we can force it
|
|
|
-ssm -f remove ${SSM_BTRFS_DEFAULT_POOL}:${vol3}
|
|
|
-not check btrfs_vol_field $mnt2 subvolume $vol3
|
|
|
-
|
|
|
-umount_all
|
|
|
-ssm -f remove --all
|
|
|
-
|
|
|
-#Remove subvolume which is not mounted
|
|
|
-ssm create $dev1 $dev2
|
|
|
-ssm create --name $vol1
|
|
|
-ssm create --name $vol2
|
|
|
-ssm create --name ${vol1}/${vol3} $mnt1
|
|
|
-
|
|
|
-check btrfs_vol_field $mnt1 vol_count 3
|
|
|
-ssm remove ${SSM_BTRFS_DEFAULT_POOL}:$vol2
|
|
|
-ssm list
|
|
|
-
|
|
|
-check btrfs_vol_field $mnt1 vol_count 2
|
|
|
-check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL dev_count 2
|
|
|
-check btrfs_vol_field $mnt1 subvolume $vol1
|
|
|
-not check btrfs_vol_field $mnt1 subvolume $vol2
|
|
|
-check btrfs_vol_field $mnt1 subvolume ${vol1}/${vol3}
|
|
|
-
|
|
|
-umount_all
|
|
|
-ssm -f remove --all
|
|
|
-
|
|
|
-not check btrfs_fs_field $pool1 label $pool1
|
|
|
-not check btrfs_fs_field $pool2 label $pool2
|
|
|
-not check btrfs_fs_field $SSM_BTRFS_DEFAULT_POOL label $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-ssm remove --help
|
|
|
-
|
|
|
-# Some cases which should fail
|
|
|
-not ssm remove
|
|
|
-not ssm -f remove --all
|
|
|
diff --git a/tests/bashtests/010-btrfs-snapshot.sh b/tests/bashtests/010-btrfs-snapshot.sh
|
|
|
deleted file mode 100755
|
|
|
index 075dedf..0000000
|
|
|
--- a/tests/bashtests/010-btrfs-snapshot.sh
|
|
|
+++ /dev/null
|
|
|
@@ -1,135 +0,0 @@
|
|
|
-#!/bin/bash
|
|
|
-#
|
|
|
-# (C)2012 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
|
|
-#
|
|
|
-# This program is free software: you can redistribute it and/or modify
|
|
|
-# it under the terms of the GNU General Public License as published by
|
|
|
-# the Free Software Foundation, either version 2 of the License, or
|
|
|
-# (at your option) any later version.
|
|
|
-#
|
|
|
-# This program is distributed in the hope that it will be useful,
|
|
|
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
-# GNU General Public License for more details.
|
|
|
-#
|
|
|
-# You should have received a copy of the GNU General Public License
|
|
|
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
-
|
|
|
-export test_name='010-btrfs-snapshot'
|
|
|
-test_description='Exercise ssm snapshot command with btrfs'
|
|
|
-
|
|
|
-. lib/test
|
|
|
-
|
|
|
-DEV_COUNT=10
|
|
|
-DEV_SIZE=300
|
|
|
-TEST_MAX_SIZE=$(($DEV_COUNT*$DEV_SIZE))
|
|
|
-aux prepare_devs $DEV_COUNT $DEV_SIZE
|
|
|
-aux prepare_mnts 10
|
|
|
-TEST_DEVS=$(cat DEVICES)
|
|
|
-export SSM_DEFAULT_BACKEND='btrfs'
|
|
|
-export SSM_BTRFS_DEFAULT_POOL=$vg1
|
|
|
-export VOL_PREFIX="vol"
|
|
|
-export SSM_NONINTERACTIVE='1'
|
|
|
-vol1=${VOL_PREFIX}001
|
|
|
-vol2=${VOL_PREFIX}002
|
|
|
-vol3=${VOL_PREFIX}003
|
|
|
-
|
|
|
-pool1=$vg2
|
|
|
-pool2=$vg3
|
|
|
-
|
|
|
-snap1="snap1"
|
|
|
-snap2="snap2"
|
|
|
-snap3="snap3"
|
|
|
-snap4="snap4"
|
|
|
-snap5="snap5"
|
|
|
-snap6="snap6"
|
|
|
-
|
|
|
-
|
|
|
-# Create volume with all devices at once
|
|
|
-ssm create $TEST_DEVS $mnt1
|
|
|
-
|
|
|
-# Take a snapshot with the default params
|
|
|
-export SSM_DEFAULT_BACKEND='lvm'
|
|
|
-ssm snapshot $mnt1
|
|
|
-check btrfs_vol_field $mnt1 vol_count 1
|
|
|
-check list_table "$(ssm list snap)" $SSM_BTRFS_DEFAULT_POOL:snap-....-..-..-....... $SSM_BTRFS_DEFAULT_POOL none btrfs $mnt1/snap-....-..-..-.......
|
|
|
-export SSM_DEFAULT_BACKEND='btrfs'
|
|
|
-
|
|
|
-umount $mnt1
|
|
|
-# Remove entire pool
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Create volume with all devices at once
|
|
|
-ssm create $TEST_DEVS
|
|
|
-
|
|
|
-# Take a snapshot with the default params
|
|
|
-ssm snapshot $SSM_BTRFS_DEFAULT_POOL
|
|
|
-mount LABEL=$SSM_BTRFS_DEFAULT_POOL $mnt1
|
|
|
-check btrfs_vol_field $mnt1 vol_count 1
|
|
|
-umount $mnt1
|
|
|
-
|
|
|
-# Remove entire pool
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-# Create volume with all devices at once
|
|
|
-ssm create $TEST_DEVS
|
|
|
-
|
|
|
-# Take a snapshot with defined name
|
|
|
-ssm snapshot --name $snap1 $SSM_BTRFS_DEFAULT_POOL
|
|
|
-ssm snapshot --name $snap2 $SSM_BTRFS_DEFAULT_POOL
|
|
|
-ssm snapshot --name $snap3 $SSM_BTRFS_DEFAULT_POOL
|
|
|
-mount LABEL=$SSM_BTRFS_DEFAULT_POOL $mnt1
|
|
|
-check btrfs_vol_field $mnt1 vol_count 3
|
|
|
-check btrfs_vol_field $mnt1 subvolume $snap1
|
|
|
-check btrfs_vol_field $mnt1 subvolume $snap2
|
|
|
-check btrfs_vol_field $mnt1 subvolume $snap3
|
|
|
-ssm_output=$(ssm list vol)
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1
|
|
|
-not check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap1 $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1/$snap1
|
|
|
-not check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap2 $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1/$snap2
|
|
|
-not check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap3 $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1/$snap3
|
|
|
-ssm_output=$(ssm list snap)
|
|
|
-not check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL $SSM_BTRFS_DEFAULT_POOL none btrfs btrfs $mnt1
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap1 $SSM_BTRFS_DEFAULT_POOL none btrfs $mnt1/$snap1
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap2 $SSM_BTRFS_DEFAULT_POOL none btrfs $mnt1/$snap2
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap3 $SSM_BTRFS_DEFAULT_POOL none btrfs $mnt1/$snap3
|
|
|
-
|
|
|
-# Remove the snapshot volumes
|
|
|
-ssm -f remove $SSM_BTRFS_DEFAULT_POOL:$snap1 $SSM_BTRFS_DEFAULT_POOL:$snap2 $SSM_BTRFS_DEFAULT_POOL:$snap3
|
|
|
-not check btrfs_vol_field $mnt1 subvolume $snap1
|
|
|
-not check btrfs_vol_field $mnt1 subvolume $snap2
|
|
|
-not check btrfs_vol_field $mnt1 subvolume $snap3
|
|
|
-
|
|
|
-# Take a snapshot with defined name when volume is mounted
|
|
|
-ssm snapshot --name $snap1 $SSM_BTRFS_DEFAULT_POOL
|
|
|
-ssm snapshot --name $snap2 $mnt1
|
|
|
-ssm snapshot --name $snap3 $SSM_BTRFS_DEFAULT_POOL
|
|
|
-
|
|
|
-ssm snapshot --name $snap4 $mnt1/$snap3
|
|
|
-ssm snapshot --name $snap3/$snap4/$snap5 $mnt1
|
|
|
-check btrfs_vol_field $mnt1 vol_count 5
|
|
|
-check btrfs_vol_field $mnt1 subvolume $snap1
|
|
|
-check btrfs_vol_field $mnt1 subvolume $snap2
|
|
|
-check btrfs_vol_field $mnt1 subvolume $snap3
|
|
|
-check btrfs_vol_field $mnt1 subvolume $snap3/$snap4
|
|
|
-check btrfs_vol_field $mnt1 subvolume $snap3/$snap4/$snap5
|
|
|
-ssm_output=$(ssm list vol)
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL $SSM_BTRFS_DEFAULT_POOL none btrfs none none btrfs $mnt1
|
|
|
-ssm_output=$(ssm list snap)
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap1 $SSM_BTRFS_DEFAULT_POOL none btrfs $mnt1/$snap1
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap2 $SSM_BTRFS_DEFAULT_POOL none btrfs $mnt1/$snap2
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap3 $SSM_BTRFS_DEFAULT_POOL none btrfs $mnt1/$snap3
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap3/$snap4 $SSM_BTRFS_DEFAULT_POOL none btrfs $mnt1/$snap3/$snap4
|
|
|
-check list_table "$ssm_output" $SSM_BTRFS_DEFAULT_POOL:$snap3/$snap4/$snap5 $SSM_BTRFS_DEFAULT_POOL none btrfs $mnt1/$snap3/$snap4/$snap5
|
|
|
-
|
|
|
-umount_all
|
|
|
-
|
|
|
-ssm -f remove --all
|
|
|
-ssm snapshot --help
|
|
|
-
|
|
|
-# Some cases which should fail
|
|
|
-not ssm snapshot
|
|
|
-ssm create $TEST_DEVS
|
|
|
-not ssm snapshot $SSM_BTRFS_DEFAULT_POOL/$lvol1
|
|
|
-
|
|
|
-ssm -f remove --all
|
|
|
diff --git a/tests/bashtests/018-migrate.sh b/tests/bashtests/018-migrate.sh
|
|
|
index fa378fd..fa1a745 100755
|
|
|
--- a/tests/bashtests/018-migrate.sh
|
|
|
+++ b/tests/bashtests/018-migrate.sh
|
|
|
@@ -80,79 +80,6 @@ not ssm migrate $mnt1 $dev1
|
|
|
#wipefs -a $dev1
|
|
|
#wipefs -a $dev2
|
|
|
|
|
|
-# BTRFS
|
|
|
-export SSM_DEFAULT_BACKEND='btrfs'
|
|
|
-
|
|
|
-# Simple btrfs migrate to plain device
|
|
|
-#ssm create $dev1
|
|
|
-#check btrfs_devices $SSM_BTRFS_DEFAULT_POOL $dev1
|
|
|
-#ssm migrate $dev1 $dev2
|
|
|
-#check btrfs_devices $SSM_BTRFS_DEFAULT_POOL $dev2
|
|
|
-#test_volume $SSM_BTRFS_DEFAULT_POOL
|
|
|
-# Btrfs migrate on device with signature (ext4)
|
|
|
-#not ssm migrate $dev2 $dev3
|
|
|
-#ssm -f migrate $dev2 $dev3
|
|
|
-#check btrfs_devices $SSM_BTRFS_DEFAULT_POOL $dev3
|
|
|
-#test_volume $SSM_BTRFS_DEFAULT_POOL
|
|
|
-#ssm -f remove --all
|
|
|
-
|
|
|
-# Simple btrfs migrate of mounted fs
|
|
|
-ssm create $dev1 $mnt1
|
|
|
-check btrfs_devices $SSM_BTRFS_DEFAULT_POOL $dev1
|
|
|
-not ssm migrate $mnt1 $dev2
|
|
|
-ssm migrate $dev1 $dev2
|
|
|
-check btrfs_devices $SSM_BTRFS_DEFAULT_POOL $dev2
|
|
|
-umount $mnt1
|
|
|
-ssm check $SSM_BTRFS_DEFAULT_POOL
|
|
|
-ssm -f remove --all
|
|
|
-
|
|
|
-# Migrate device from multi-device btrfs
|
|
|
-ssm create -p $vg1 $dev1 $dev2
|
|
|
-ssm create -p $vg2 $dev3 $dev4 $dev5
|
|
|
-ssm -f migrate $dev2 $dev6
|
|
|
-check btrfs_devices $vg1 $dev1 $dev6
|
|
|
-check btrfs_devices $vg2 $dev3 $dev4 $dev5
|
|
|
-test_volume $vg1
|
|
|
-test_volume $vg2
|
|
|
-
|
|
|
-# Migrate to a device already used in btrfs pool
|
|
|
-not ssm migrate $dev1 $dev3
|
|
|
-ssm -f migrate $dev1 $dev3
|
|
|
-check btrfs_devices $vg1 $dev3 $dev6
|
|
|
-check btrfs_devices $vg2 $dev4 $dev5
|
|
|
-test_volume $vg1
|
|
|
-test_volume $vg2
|
|
|
-ssm -f remove --all
|
|
|
-
|
|
|
-# Do not allow migrate between devices within a single pool in btrfs
|
|
|
-ssm create $dev1 $dev2 $dev3 $dev4
|
|
|
-not ssm migrate $dev1 $dev2
|
|
|
-not ssm -f migrate $dev1 $dev2
|
|
|
-check btrfs_devices $SSM_BTRFS_DEFAULT_POOL $dev1 $dev2 $dev3 $dev4
|
|
|
-ssm -f remove --all
|
|
|
-
|
|
|
-# migrate plain device to a device in btrfs pool - not used
|
|
|
-#ssm create -p $vg1 $dev1 $dev2 $dev3
|
|
|
-#mkfs.ext4 -F $dev4
|
|
|
-#not ssm migrate $dev4 $dev3
|
|
|
-#ssm -f migrate $dev4 $dev3
|
|
|
-#check btrfs_devices $vg1 $dev1 $dev2
|
|
|
-#test_volume $vg1
|
|
|
-#fsck.ext4 -fn $dev3
|
|
|
-
|
|
|
-# migrate plain device to a device in btrfs pool - used completely
|
|
|
-#ssm -f add -p $vg1 $dev3
|
|
|
-#ssm mount $vg1 $mnt1
|
|
|
-# Fill it up as much as we can, we do not care if dd fails
|
|
|
-#! dd if=/dev/zero of=$mnt1/file bs=1M
|
|
|
-#sync
|
|
|
-#umount $mnt1
|
|
|
-#not ssm migrate $dev4 $dev1
|
|
|
-#not ssm -f migrate $dev4 $dev1
|
|
|
-#check btrfs_devices $vg1 $dev1 $dev2 $dev3
|
|
|
-#test_volume $vg1
|
|
|
-#ssm -f remove --all
|
|
|
-
|
|
|
export SSM_DEFAULT_BACKEND='lvm'
|
|
|
|
|
|
# LVM
|
|
|
@@ -252,29 +179,6 @@ check vg_devices $SSM_LVM_DEFAULT_POOL $dev1 $dev2 $dev3 $dev5
|
|
|
#test_volume $dev5
|
|
|
ssm -f remove --all
|
|
|
|
|
|
-# migrate from btrfs pool to lvm
|
|
|
-wipefs -a $dev4 $dev5
|
|
|
-ssm -b btrfs create -p $vg1 $dev1 $dev2 $dev3
|
|
|
-ssm -b lvm create --fs ext4 -p $vg2 $dev4 $dev5
|
|
|
-not ssm migrate $dev5 $dev3
|
|
|
-ssm -f migrate $dev5 $dev3
|
|
|
-check btrfs_devices $vg1 $dev1 $dev2
|
|
|
-check vg_devices $vg2 $dev4 $dev5 $dev3
|
|
|
-test_volume $vg1
|
|
|
-test_volume $vg2/$lvol1
|
|
|
-ssm -f remove --all
|
|
|
-
|
|
|
-# migrate from lvm to btrfs pool
|
|
|
-ssm -b btrfs create -p $vg1 $dev1 $dev2 $dev3
|
|
|
-ssm -b lvm create --fs ext4 -p $vg2 $dev4 $dev5
|
|
|
-ssm add -p $vg2 $dev6
|
|
|
-not ssm migrate $dev3 $dev6
|
|
|
-ssm -f migrate $dev3 $dev6
|
|
|
-check btrfs_devices $vg1 $dev1 $dev2 $dev6
|
|
|
-check vg_devices $vg2 $dev4 $dev5
|
|
|
-test_volume $vg1
|
|
|
-test_volume $vg2/$lvol1
|
|
|
-ssm -f remove --all
|
|
|
|
|
|
# CRYPT
|
|
|
|
|
|
--
|
|
|
2.21.0
|
|
|
|