Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
CORTX-30751: Codacy code cleanup (#1606)
Browse files Browse the repository at this point in the history
This patch fixes some of the codacy warnings.
warning fixed : "Double quote to prevent globing and words splitting".

Signed-off-by: alfhad <fahadshah2411@gmail.com>
  • Loading branch information
alfhad committed Jun 22, 2022
1 parent 882a3a0 commit 242fce4
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions spiel/st/m0t1fs_spiel_sns_repair.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ M0_SRC_DIR=`readlink -f $0`
M0_SRC_DIR=${M0_SRC_DIR%/*/*/*}
testname="spiel-sns-repair"

. $M0_SRC_DIR/spiel/st/m0t1fs_spiel_sns_common_inc.sh
. "$M0_SRC_DIR"/spiel/st/m0t1fs_spiel_sns_common_inc.sh


spiel_sns_repair_and_rebalance_test()
Expand All @@ -31,12 +31,12 @@ spiel_sns_repair_and_rebalance_test()
local fail_device2=9
local fail_device3=3

local_write $src_bs $src_count || return $?
local_write "$src_bs" "$src_count" || return $?

echo "Starting SNS repair testing ..."
for ((i=0; i < ${#files[*]}; i++)) ; do
touch_file $MOTR_M0T1FS_MOUNT_DIR/${files[$i]} ${unit_size[$i]}
_dd ${files[$i]} $((${unit_size[$i]} * 1024)) ${file_size[$i]}
touch_file "$MOTR_M0T1FS_MOUNT_DIR"/"${files[$i]}" "${unit_size[$i]}"
_dd "${files[$i]}" $((${unit_size[$i]} * 1024)) "${file_size[$i]}"
done

verify || return $?
Expand Down Expand Up @@ -132,21 +132,21 @@ test_repaired_device_failure()
{
local fail_device1=$1

disk_state_get $fail_device1 || return $?
disk_state_get "$fail_device1" || return $?

disk_state_set "rebalance" $fail_device1 || return $?
disk_state_set "rebalance" "$fail_device1" || return $?
echo "Starting SNS Rebalance.."
spiel_sns_rebalance_start

echo "wait for sns Re-balance"
spiel_wait_for_sns_rebalance || return $?
sleep 2

disk_state_set "online" $fail_device1 || return $?
disk_state_set "online" "$fail_device1" || return $?
echo "SNS Rebalance done."

verify || return $?
disk_state_get $fail_device1 || return $?
disk_state_get "$fail_device1" || return $?
}

test_new_device_failure()
Expand All @@ -155,8 +155,8 @@ test_new_device_failure()
local fail_device2=$2

echo "Set $fail_device2 to "failed""
disk_state_set "failed" $fail_device2 || return $?
disk_state_set "repair" $fail_device2 || return $?
disk_state_set "failed" "$fail_device2" || return $?
disk_state_set "repair" "$fail_device2" || return $?

echo "Start SNS repair again"
spiel_sns_repair_start
Expand All @@ -166,23 +166,23 @@ test_new_device_failure()
spiel_wait_for_sns_repair || return $?
verify || return $?

disk_state_set "repaired" $fail_device2 || return $?
disk_state_set "repaired" "$fail_device2" || return $?

disk_state_get $fail_device1 $fail_device2 || return $?
disk_state_get "$fail_device1" "$fail_device2" || return $?

disk_state_set "rebalance" $fail_device1 $fail_device2 || return $?
disk_state_set "rebalance" "$fail_device1" "$fail_device2" || return $?
echo "Starting SNS Rebalance.."
spiel_sns_rebalance_start

echo "wait for sns Re-balance"
spiel_wait_for_sns_rebalance || return $?
sleep 2

disk_state_set "online" $fail_device1 $fail_device2 || return $?
disk_state_set "online" "$fail_device1" "$fail_device2" || return $?
echo "SNS Rebalance done."

verify || return $?
disk_state_get $fail_device1 $fail_device2 || return $?
disk_state_get "$fail_device1" "$fail_device2" || return $?
}

rebalance_abort()
Expand All @@ -191,23 +191,23 @@ rebalance_abort()
local fail_device2=$2

echo "Set Failure device: $fail_device1"
disk_state_set "failed" $fail_device1 || return $?
disk_state_set "failed" "$fail_device1" || return $?

echo "Start SNS repair."
echo "set $fail_device1 to repairing"
disk_state_set "repair" $fail_device1 || return $?
disk_state_set "repair" "$fail_device1" || return $?
spiel_sns_repair_start
sleep 2

echo "wait for sns repair to finish."
spiel_wait_for_sns_repair || return $?

disk_state_set "repaired" $fail_device1 || return $?
disk_state_set "repaired" "$fail_device1" || return $?
echo "SNS Repair done."
verify || return $?

disk_state_set "rebalance" $fail_device1 || return $?
disk_state_get $fail_device1 || return $?
disk_state_set "rebalance" "$fail_device1" || return $?
disk_state_get "$fail_device1" || return $?
sleep 2
echo "Starting SNS Re-balance.."
spiel_sns_rebalance_start
Expand All @@ -218,12 +218,12 @@ rebalance_abort()
spiel_wait_for_sns_rebalance || return $?

echo "Set $fail_device1 back to "repaired""
disk_state_set "repaired" $fail_device1 || return $?
if [ $fail_device1 -eq $fail_device2 ]
disk_state_set "repaired" "$fail_device1" || return $?
if [ "$fail_device1" -eq "$fail_device2" ]
then
test_repaired_device_failure $fail_device1
test_repaired_device_failure "$fail_device1"
else
test_new_device_failure $fail_device1 $fail_device2
test_new_device_failure "$fail_device1" "$fail_device2"
fi
}

Expand Down Expand Up @@ -252,7 +252,7 @@ main()
spiel_cleanup

echo "unmounting and cleaning.."
unmount_and_clean &>> $MOTR_TEST_LOGFILE
unmount_and_clean &>> "$MOTR_TEST_LOGFILE"

motr_service stop || {
echo "Failed to stop Motr Service."
Expand Down

0 comments on commit 242fce4

Please sign in to comment.