Browse Source

_create_thin_lv_gluster_vol: retry mounting the lv

Also took the opportunity to move to test_with_retry
instead of using a hand-rolled retry loop.

Closes-Bug: #1524656
Change-Id: I0fff95b434a6572efd2af3ac2ec89b5772459cd5
Csaba Henk 3 years ago
parent
commit
21d2009e02
1 changed files with 2 additions and 17 deletions
  1. 2
    17
      devstack/gluster-functions.sh

+ 2
- 17
devstack/gluster-functions.sh View File

@@ -226,26 +226,11 @@ function _create_thin_lv_gluster_vol {
226 226
     sudo lvcreate -V $vol_size -T $GLUSTERFS_VG_NAME/$GLUSTERFS_THIN_POOL_NAME -n $vol_name
227 227
 
228 228
     # Format the LV.
229
-    local mkfs_result=0
230
-    local i
231
-    for i in `seq 100`; do
232
-        mkfs_result=0
233
-        sudo mkfs.xfs -i size=512 /dev/$GLUSTERFS_VG_NAME/$vol_name || mkfs_result=$?
234
-        [ $mkfs_result -eq 0 ] && break
235
-        sleep 0.1
236
-    done
237
-    local mkfs_duration="$((i/10)).$((i%10))"
238
-    if [ $mkfs_result -eq 0 ]; then
239
-        echo "mkfs.xfs succeeded after retrying for $mkfs_duration"
240
-        true
241
-    else
242
-        echo "giving up on mkfs.xfs after retrying for $mkfs_duration with exit code $mkfs_result"
243
-        false
244
-    fi
229
+    test_with_retry "sudo mkfs.xfs -i size=512 /dev/$GLUSTERFS_VG_NAME/$vol_name" "mkfs.xfs failed"
245 230
 
246 231
     # Mount the filesystem
247 232
     mkdir -p $MANILA_STATE_PATH/export/$vol_name
248
-    sudo mount /dev/$GLUSTERFS_VG_NAME/$vol_name $MANILA_STATE_PATH/export/$vol_name
233
+    test_with_retry "sudo mount /dev/$GLUSTERFS_VG_NAME/$vol_name $MANILA_STATE_PATH/export/$vol_name" "mounting XFS from the LV failed"
249 234
 
250 235
     # Create a directory that would serve as a brick.
251 236
     sudo mkdir -p $MANILA_STATE_PATH/export/$vol_name/brick

Loading…
Cancel
Save