~registry/uec-testing-scripts/trunk

50 by C de-Avillez
added stress/boundary test for volume allocation
1
#! /bin/bash
2
3
# Jaguar project/UEC Testing
4
#
5
# creates all the volumes that can be created, and then one more.
6
# 
7
# NEEDS:
8
# 1. Eucalyptus Web admin/Configuration to be set allowing 
9
#    at least (# loop devices) GB of storage per user
10
# 2. an *empty* SC -- no volumes defined (since we will use them all).
11
12
MAX_VOL=512
13
ZONE="UEC-TEST1"
14
CONFIG="/home/ubuntu/eucarc"
15
16
vol_check()
17
{
18
	for j in $(seq 1 10); do
52 by C de-Avillez
time calls to e-d-v, echo totals
19
		output=$(time euca-describe-volumes --config=$CONFIG $VOL_ID 2>&1)
50 by C de-Avillez
added stress/boundary test for volume allocation
20
		RC=$?
21
		if [ $RC -ne 0 ]; then
22
			echo "euca-describe-volumes $VOL_ID returned error $RC"
23
			echo $output
24
		fi
52 by C de-Avillez
time calls to e-d-v, echo totals
25
		echo $output | egrep ^real 2>&1
26
		VOL_Status=$(echo $output | egrep ^VOLUME | awk '{print $5}')
50 by C de-Avillez
added stress/boundary test for volume allocation
27
		if [ "x$VOL_Status" == "xavailable" ]; then
28
			break
29
		else
52 by C de-Avillez
time calls to e-d-v, echo totals
30
			echo "j=${j}, sleeping 1 sec"
50 by C de-Avillez
added stress/boundary test for volume allocation
31
			sleep 1
32
		fi
33
	done
34
}
35
36
vol_delete()
37
{
38
    for vol in $(euca-describe-volumes --config=$CONFIG | awk '{print $2}'); do
39
        euca-delete-volume  --config=$CONFIG $vol
52 by C de-Avillez
time calls to e-d-v, echo totals
40
        while [ "x$vol" != "x" ] ; do
41
            vol=$(euca-describe-volumes  --config=$CONFIG $vol | awk '{print $2}')
50 by C de-Avillez
added stress/boundary test for volume allocation
42
        done
43
    done
44
}
45
46
FAILED=0
47
48
for i in $(seq 1 $MAX_VOL); do
52 by C de-Avillez
time calls to e-d-v, echo totals
49
	echo "creating volume #=$i"
50 by C de-Avillez
added stress/boundary test for volume allocation
50
	output=$(euca-create-volume --config=$CONFIG -s 1 -z $ZONE 2>&1)
51
	RC=$?
52
	if [ $RC -ne 0 ]; then
53
		echo "euca-create-volume returned error=$RC"
54
		echo $output
55
		FAILED=1
56
	fi
57
58
	VOl_ID=$(echo $output | awk '{print $2}')
59
	vol_check
60
	if [ "x$VOL_Status" != "xavailable" ]; then
61
		echo "failed to create volume $VOL_ID"
62
		echo $output
63
		FAILED=1
64
	fi
65
done
66
if [ $FAILED -gt 0 ]; then
67
	echo "at least one volume allocation failed. Stopping."
68
	exit 3
69
fi
52 by C de-Avillez
time calls to e-d-v, echo totals
70
total_vols=$(euca-describe-volumes --config=$CONFIG | wc -l)
71
echo "tried to create $i volumes, e-d-v reports $total_vols volumes"
50 by C de-Avillez
added stress/boundary test for volume allocation
72
73
# now go and allocate one more volume than possible
74
75
output=$(euca-create-volume -z $ZONE -s1 --config=$CONFIG 2>&1)
76
RC=$?
77
if [ $RC -ne 0 ]; then
78
	echo "Create OneMoreVolume failed: euca-create-volume returned error=$RC"
79
	echo $output
80
	FAILED=1
81
fi
82
VOl_ID=$(echo $output | awk '{print $2}')
83
vol_check
84
if [ "x$VOL_Status" != "xfailed" ]; then
85
	FAILED=1
86
	echo "failed to fail to create One More Volume $VOL_ID"
87
	echo $output
88
fi
89
90
# delete them all
91
vol_delete
92
echo "do not forget to verify if no loop devices, VGs, and LV were left over in the SC"
93
if [ $FAILED ] ; then
94
	exit 1
95
else
96
	exit 0
97
fi