Browse code

Add timing info to volume exercises.

Looking at some failures lately in Jenkins/Devstack runs and it would
be handy to see if failures were time-out related versus flat out failed
operations.

More interestingly it might be worthwile to harvest the completion time
info from the jenkins logs and keep track of any significant deviations
introduced by code changes.

Change-Id: I3bbcc5b9f8a4da2fcdb9f6f70913c2d6bc6e2b9b

John Griffith authored on 2012/09/27 06:09:52
Showing 1 changed files
... ...
@@ -154,10 +154,16 @@ if [[ $? != 0 ]]; then
154 154
     echo "Failure creating volume $VOL_NAME"
155 155
     exit 1
156 156
 fi
157
+
158
+start_time=`date +%s`
157 159
 if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then
158 160
     echo "Volume $VOL_NAME not created"
161
+    end_time=`date +%s`
162
+    echo "Failed volume-create after $((end_time - start_time)) seconds"
159 163
     exit 1
160 164
 fi
165
+end_time=`date +%s`
166
+echo "Completed volume-create in $((end_time - start_time)) seconds"
161 167
 
162 168
 # Get volume ID
163 169
 VOL_ID=`nova volume-list | grep $VOL_NAME | head -1 | get_field 1`
... ...
@@ -165,12 +171,17 @@ die_if_not_set VOL_ID "Failure retrieving volume ID for $VOL_NAME"
165 165
 
166 166
 # Attach to server
167 167
 DEVICE=/dev/vdb
168
+start_time=`date +%s`
168 169
 nova volume-attach $VM_UUID $VOL_ID $DEVICE || \
169 170
     die "Failure attaching volume $VOL_NAME to $NAME"
170 171
 if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep in-use; do sleep 1; done"; then
171 172
     echo "Volume $VOL_NAME not attached to $NAME"
173
+    end_time=`date +%s`
174
+    echo "Failed volume-attach after $((end_time - start_time)) seconds"
172 175
     exit 1
173 176
 fi
177
+end_time=`date +%s`
178
+echo "Completed volume-attach in $((end_time - start_time)) seconds"
174 179
 
175 180
 VOL_ATTACH=`nova volume-list | grep $VOL_NAME | head -1 | get_field -1`
176 181
 die_if_not_set VOL_ATTACH "Failure retrieving $VOL_NAME status"
... ...
@@ -180,18 +191,28 @@ if [[ "$VOL_ATTACH" != $VM_UUID ]]; then
180 180
 fi
181 181
 
182 182
 # Detach volume
183
+start_time=`date +%s`
183 184
 nova volume-detach $VM_UUID $VOL_ID || die "Failure detaching volume $VOL_NAME from $NAME"
184 185
 if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then
185 186
     echo "Volume $VOL_NAME not detached from $NAME"
187
+    end_time=`date +%s`
188
+    echo "Failed volume-detach after $((end_time - start_time)) seconds"
186 189
     exit 1
187 190
 fi
191
+end_time=`date +%s`
192
+echo "Completed volume-detach in $((end_time - start_time)) seconds"
188 193
 
189 194
 # Delete volume
195
+start_time=`date +%s`
190 196
 nova volume-delete $VOL_ID || die "Failure deleting volume $VOL_NAME"
191 197
 if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME; do sleep 1; done"; then
192 198
     echo "Volume $VOL_NAME not deleted"
199
+    end_time=`date +%s`
200
+    echo "Failed volume-delete after $((end_time - start_time)) seconds"
193 201
     exit 1
194 202
 fi
203
+end_time=`date +%s`
204
+echo "Completed volume-delete in $((end_time - start_time)) seconds"
195 205
 
196 206
 # Shutdown the server
197 207
 nova delete $VM_UUID || die "Failure deleting instance $NAME"