Browse Source

Restrict scope of loop control variables to local

Some of the loop control variables are global. This as expected has
lead to corruption of their values, and produced undesired results.
Fix this issue by setting the scope of these variables to local.

Closes Bug: #1523348

Change-Id: I0f5676c5a0b97d3e027a1e7677b4b5a21470913b
Ramana Raja 3 years ago
parent
commit
28fc5d375f
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      devstack/gluster-functions.sh

+ 3
- 0
devstack/gluster-functions.sh View File

@@ -75,6 +75,7 @@ function _delete_gluster_shares {
75 75
         gluster_volumes+=,$(echo $share | cut -d/ -f2);
76 76
     done
77 77
 
78
+    local vol_name
78 79
     for vol_name in $(echo $gluster_volumes | sed "s/,/ /g"); do
79 80
         sudo gluster --mode=script volume stop $vol_name
80 81
         sudo gluster --mode=script volume delete $vol_name
@@ -226,6 +227,7 @@ function _create_thin_lv_gluster_vol {
226 227
 
227 228
     # Format the LV.
228 229
     local mkfs_result=0
230
+    local i
229 231
     for i in `seq 100`; do
230 232
         mkfs_result=0
231 233
         sudo mkfs.xfs -i size=512 /dev/$GLUSTERFS_VG_NAME/$vol_name || mkfs_result=$?
@@ -320,6 +322,7 @@ function _configure_manila_glusterfs_native {
320 322
     # Create four GlusterFS volumes to be used as shares.
321 323
     _create_thin_lv_pool
322 324
 
325
+    local i
323 326
     for i in `seq 1 20`; do
324 327
         _create_thin_lv_gluster_vol manila-glusterfs-native-vol-20G-$i 20G
325 328
         # Configure the volume to use GlusterFS's TLS support required by the

Loading…
Cancel
Save