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