refactor ping_check
Encapsulate all the neutron specific things you have to do ping a neutron guest into a separate script. Refactor the main ping_check so all logic is contained within it. Change-Id: Ic79d8e3a2473b978551a5635a11dba07e1020bb2
This commit is contained in:
@@ -1404,27 +1404,6 @@ function _get_probe_cmd_prefix {
|
||||
echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id"
|
||||
}
|
||||
|
||||
function _ping_check_neutron {
|
||||
local from_net=$1
|
||||
local ip=$2
|
||||
local timeout_sec=$3
|
||||
local expected=${4:-"True"}
|
||||
local check_command=""
|
||||
probe_cmd=`_get_probe_cmd_prefix $from_net`
|
||||
if [[ "$expected" = "True" ]]; then
|
||||
check_command="while ! $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done"
|
||||
else
|
||||
check_command="while $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done"
|
||||
fi
|
||||
if ! timeout $timeout_sec sh -c "$check_command"; then
|
||||
if [[ "$expected" = "True" ]]; then
|
||||
die $LINENO "[Fail] Couldn't ping server"
|
||||
else
|
||||
die $LINENO "[Fail] Could ping server"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# ssh check
|
||||
function _ssh_check_neutron {
|
||||
local from_net=$1
|
||||
|
||||
Reference in New Issue
Block a user