File tree 2 files changed +30
-10
lines changed
2 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ test_lvm_sig() {
7
7
local test_status=1
8
8
local testname=` basename " $0 " `
9
9
local vg_name=" css-test-foo"
10
+ local tmplog=${WORKDIR} /tmplog
11
+ local errmsg=" Wipe signatures using wipefs or use WIPE_SIGNATURES=true and retry."
10
12
11
13
# Error out if any pre-existing volume group vg named css-test-foo
12
14
if vg_exists " $vg_name " ; then
25
27
done
26
28
27
29
# Run container-storage-setup
28
- $CSSBIN >> $LOGS 2>&1
29
-
30
- # Css should fail. If it did not, then test failed. This is very crude
31
- # check though as css can fail for so many reasons. A more precise check
32
- # would be too check for exact error message.
33
- [ $? -ne 0 ] && test_status=0
30
+ $CSSBIN > $tmplog 2>&1
31
+ rc=$?
32
+ cat $tmplog >> $LOGS 2>&1
33
+
34
+ # Test failed.
35
+ if [ $rc -ne 0 ]; then
36
+ if grep --no-messages -q " $errmsg " $tmplog ; then
37
+ test_status=0
38
+ else
39
+ echo " ERROR: $testname : $CSSBIN Failed for a reason other then \" $errmsg \" " >> $LOGS
40
+ fi
41
+ else
42
+ echo " ERROR: $testname : $CSSBIN Succeeded. Should have failed since LVM2_member signature exists on devices $devs " >> $LOGS
43
+ fi
34
44
35
- cleanup $vg_name " $ devs"
45
+ cleanup_pvs_sig $ devs
36
46
return $test_status
37
47
}
38
48
49
+ cleanup_pvs_sig () {
50
+ local devs=$1
51
+ for dev in $devs ; do
52
+ pvremove -y ${dev} >> $LOGS 2>&1
53
+ done
54
+ wipe_signatures " $devs "
55
+ }
56
+
39
57
# Make sure a disk with lvm signature is rejected and is not overriden
40
58
# by css. Returns 0 on success and 1 on failure.
41
59
Original file line number Diff line number Diff line change @@ -72,11 +72,13 @@ lv_is_active() {
72
72
return 1
73
73
}
74
74
75
- remove_pvs () {
75
+ remove_pvs_part () {
76
76
local dev devs=$1 pv
77
77
for dev in $devs ; do
78
78
pv=$( lsblk -npl -o NAME " $dev " | tail -n +2 | head -1)
79
- pvremove -y ${pv} >> $LOGS 2>&1
79
+ if [ -n " $pv " ]; then
80
+ pvremove -y ${pv} >> $LOGS 2>&1
81
+ fi
80
82
done
81
83
}
82
84
@@ -127,7 +129,7 @@ cleanup() {
127
129
128
130
129
131
vgremove -y $vg_name >> $LOGS 2>&1
130
- remove_pvs " $devs "
132
+ remove_pvs_part " $devs "
131
133
remove_partitions " $devs "
132
134
# After removing partitions let udev settle down. In some
133
135
# cases it has been observed that udev rule kept the device
You can’t perform that action at this time.
0 commit comments