Browse Source

retry mkfs.xfs until subject LV becomes available (or a time bound is reached)

Closes-Bug: #1499223
Change-Id: I7ede18cadad1c7a30d740ae17cab52b3b9271ce0
changes/14/227214/3
Csaba Henk 3 years ago
parent
commit
9110aa631b
1 changed files with 15 additions and 1 deletions
  1. 15
    1
      devstack/gluster-functions.sh

+ 15
- 1
devstack/gluster-functions.sh View File

@@ -225,7 +225,21 @@ function _create_thin_lv_gluster_vol {
225 225
     sudo lvcreate -V $vol_size -T $GLUSTERFS_VG_NAME/$GLUSTERFS_THIN_POOL_NAME -n $vol_name
226 226
 
227 227
     # Format the LV.
228
-    sudo mkfs.xfs -i size=512 /dev/$GLUSTERFS_VG_NAME/$vol_name
228
+    local mkfs_result=0
229
+    for i in `seq 100`; do
230
+        mkfs_result=0
231
+        sudo mkfs.xfs -i size=512 /dev/$GLUSTERFS_VG_NAME/$vol_name || mkfs_result=$?
232
+        [ $mkfs_result -eq 0 ] && break
233
+        sleep 0.1
234
+    done
235
+    local mkfs_duration="$((i/10)).$((i%10))"
236
+    if [ $mkfs_result -eq 0 ]; then
237
+        echo "mkfs.xfs succeeded after retrying for $mkfs_duration"
238
+        true
239
+    else
240
+        echo "giving up on mkfs.xfs after retrying for $mkfs_duration with exit code $mkfs_result"
241
+        false
242
+    fi
229 243
 
230 244
     # Mount the filesystem
231 245
     mkdir -p $MANILA_STATE_PATH/export/$vol_name

Loading…
Cancel
Save