Fix linters issues and enable tox/zuul linters job as gate

Fix below linters issues
 E001 Trailing Whitespace
 E003 Indent not multiple of 4
 E006 Line too long
 E011 Then keyword is not on same line as if or elif keyword
 E020 Function declaration not in format ^function name {$
 E040 Syntax error: syntax error near unexpected token `;'

ignore cases are added in tox setup
 E006 Line too long
 E010: do not on the same line as for

Story: 2003368
Task: 24427

Change-Id: I6acf64271a4e608be8bc8fa965cac4fa31e0c05b
Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
Sun Austin 2018-08-28 16:07:12 +08:00
parent 82e851d651
commit fedb95ba79
15 changed files with 495 additions and 504 deletions

View File

@ -4,3 +4,7 @@
jobs:
- openstack-tox-pep8:
voting: false
- openstack-tox-linters
gate:
jobs:
- openstack-tox-linters

View File

@ -8,64 +8,64 @@ WORKING_DIR=""
COPY_DIR=""
ISODIR=$(dirname `readlink -f $0`)
usage() {
echo "Usage: $0 -u <http base URL> [-t <tftp pxeboot directory>] or [-w <working directory>]" 1>&2;
exit 0;
usage() {
echo "Usage: $0 -u <http base URL> [-t <tftp pxeboot directory>] or [-w <working directory>]" 1>&2;
exit 0;
}
while getopts ":u:t:w:" opt; do
case "$opt" in
u)
BASE_URL=${OPTARG}
;;
t)
TFTP_DIR=${OPTARG}
;;
w)
WORKING_DIR=${OPTARG}
;;
*)
usage
;;
esac
case "$opt" in
u)
BASE_URL=${OPTARG}
;;
t)
TFTP_DIR=${OPTARG}
;;
w)
WORKING_DIR=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "$BASE_URL" ]; then
echo "HTTP base URL is required: -u <http base URL>"
exit 0
echo "HTTP base URL is required: -u <http base URL>"
exit 0
fi
if [ -z "$TFTP_DIR" ] && [ -z "$WORKING_DIR" ]; then
echo "Either tftp pxeboot directory or working directory has to be specified:"
echo "-t <tftp pxeboot directory> or -w <working directory>"
exit 0
echo "Either tftp pxeboot directory or working directory has to be specified:"
echo "-t <tftp pxeboot directory> or -w <working directory>"
exit 0
elif [ -n "$TFTP_DIR" ]; then
if [ -n "$WORKING_DIR" ]; then
echo "tftp pxeboot directory is supplied, working directory will be ignored."
fi
COPY_DIR=$TFTP_DIR
if [ -n "$WORKING_DIR" ]; then
echo "tftp pxeboot directory is supplied, working directory will be ignored."
fi
COPY_DIR=$TFTP_DIR
elif [ -n "$WORKING_DIR" ]; then
COPY_DIR=$WORKING_DIR
COPY_DIR=$WORKING_DIR
fi
if [ ! -d ${COPY_DIR} ] ; then
if [ -w "$(dirname $COPY_DIR)" ]; then
echo "Create ${COPY_DIR}"
mkdir ${COPY_DIR}
chmod +w ${COPY_DIR}
if [ $? -ne 0 ]; then
echo "Can't create ${COPY_DIR}"
exit 1
fi
else
echo "$COPY_DIR parent directory is not writeable."
exit 0
fi
if [ -w "$(dirname $COPY_DIR)" ]; then
echo "Create ${COPY_DIR}"
mkdir ${COPY_DIR}
chmod +w ${COPY_DIR}
if [ $? -ne 0 ]; then
echo "Can't create ${COPY_DIR}"
exit 1
fi
else
echo "$COPY_DIR parent directory is not writeable."
exit 0
fi
else
echo "$COPY_DIR already exists"
exit 0
echo "$COPY_DIR already exists"
exit 0
fi
#Copy the vmlinuz and initrd files to the destination directory
@ -104,8 +104,8 @@ rm -Rf ${COPY_DIR}/EFI/BOOT
rm -Rf ${COPY_DIR}/pxeboot
if [ -n "$TFTP_DIR" ]; then
#Create pxelinux.cfg directory and default link
mkdir ${TFTP_DIR}/pxelinux.cfg
chmod 755 ${TFTP_DIR}/pxelinux.cfg
ln -s ../pxeboot.cfg ${TFTP_DIR}/pxelinux.cfg/default
fi
#Create pxelinux.cfg directory and default link
mkdir ${TFTP_DIR}/pxelinux.cfg
chmod 755 ${TFTP_DIR}/pxelinux.cfg
ln -s ../pxeboot.cfg ${TFTP_DIR}/pxelinux.cfg/default
fi

View File

@ -16,18 +16,18 @@ set -x
echo "$(date): Starting execution: $0 $@"
cleanup() {
rm -rf $TMP_RPM
rm -rf $TMP_RPM
}
rollback() {
rm -rf $FEED_DIR
rm -rf $FEED_DIR
}
error() {
local parent_lineno="$1"
local err_code="${2}"
echo "Error executing import script at line: ${parent_lineno} with error code: ${err_code}"
rollback
exit "${err_code}"
local parent_lineno="$1"
local err_code="${2}"
echo "Error executing import script at line: ${parent_lineno} with error code: ${err_code}"
rollback
exit "${err_code}"
}
trap 'error ${LINENO} $?' ERR

View File

@ -14,8 +14,7 @@
# -o /pxeboot/pxelinux.cfg/01-08-00-27-3e-f8-05 -b sda -r sda -t -c ttyS0,115200
#
function usage()
{
function usage {
cat >&2 <<EOF
$0: This utility is used to generate a node-specific pxeboot.cfg file
@ -37,33 +36,28 @@ EOF
declare text_install="inst.text"
function generate_config()
{
function generate_config {
input=$1
output=$2
if [ ! -f "$input" ]
then
if [ ! -f "$input" ]; then
logger --stderr -t $0 "Error: Input file $input does not exist"
exit 1
fi
if [ ! -w $(dirname $output) ]
then
if [ ! -w $(dirname $output) ]; then
logger --stderr -t $0 "Error: Destination directory $(dirname $output) not writeable"
exit 1
fi
if [ -e $output -a ! -w $output ]
then
if [ -e $output -a ! -w $output ]; then
logger --stderr -t $0 "Error: Destination file $output_file_efi exists and is not writeable"
exit 1
fi
sed -e "s#xxxAPPEND_OPTIONSxxx#$APPEND_OPTIONS#" $input > $output
if [ $? -ne 0 -o ! -f $output ]
then
if [ $? -ne 0 -o ! -f $output ]; then
logger --stderr -t $0 "Error: Failed to generate pxeboot file $output"
exit 1
fi
@ -126,12 +120,11 @@ done
# Validate parameters
if [ -z "$input_file" \
-o -z "$input_file_efi" \
-o -z "$output_file" \
-o -z "$output_file_efi" \
-o -z "$boot_device" \
-o -z "$rootfs_device" ]
then
-o -z "$input_file_efi" \
-o -z "$output_file" \
-o -z "$output_file_efi" \
-o -z "$boot_device" \
-o -z "$rootfs_device" ]; then
logger --stderr -t $0 "Error: One or more mandatory options not specified: $@"
usage
exit 1
@ -139,18 +132,15 @@ fi
APPEND_OPTIONS="boot_device=$boot_device rootfs_device=$rootfs_device"
if [ -n "$text_install" ]
then
if [ -n "$text_install" ]; then
APPEND_OPTIONS="$APPEND_OPTIONS $text_install"
fi
if [ -n "$console" ]
then
if [ -n "$console" ]; then
APPEND_OPTIONS="$APPEND_OPTIONS console=$console"
fi
if [ -n "$tisnotify" ]
then
if [ -n "$tisnotify" ]; then
APPEND_OPTIONS="$APPEND_OPTIONS tisnotify=$tisnotify"
fi
@ -160,13 +150,11 @@ APPEND_OPTIONS="$APPEND_OPTIONS inst.gpt"
# Add k8s support for namespaces
APPEND_OPTIONS="$APPEND_OPTIONS user_namespace.enable=1"
if [ -n "$security_profile" ]
then
if [ -n "$security_profile" ]; then
APPEND_OPTIONS="$APPEND_OPTIONS security_profile=$security_profile"
fi
if [ -n "$kernal_extra_args" ]
then
if [ -n "$kernal_extra_args" ]; then
APPEND_OPTIONS="$APPEND_OPTIONS $kernal_extra_args"
fi
@ -174,9 +162,8 @@ generate_config $input_file $output_file
# for extended security profile UEFI boot only,
# a tboot option will be passed to target boot option menu
if [ "$security_profile" == "extended" -a -n "$tboot" ]
then
APPEND_OPTIONS="$APPEND_OPTIONS tboot=$tboot"
if [ "$security_profile" == "extended" -a -n "$tboot" ]; then
APPEND_OPTIONS="$APPEND_OPTIONS tboot=$tboot"
fi
generate_config $input_file_efi $output_file_efi

View File

@ -131,7 +131,7 @@ count=$((count + 1))
echo $banner
echo "$count Delete Host Services"
echo $banner
curl -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'User-Agent: vim/1.0' http://localhost:2410/v1/hosts/$hostuuid
curl -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'User-Agent: vim/1.0' http://localhost:2410/v1/hosts/$hostuuid
count=$((count + 1))

View File

@ -48,7 +48,7 @@
# skipping 'sshd' process
# sw-patch-agent restart PASSED [2740]:[17461]
# sw-patch-controller-daemon restart PASSED [2558]:[21336]
# sysinv-agent restart PASSED [2757]:[25128]
# sysinv-agent restart PASSED [2757]:[25128]
# syslog-ng restart PASSED [684]:[28125]
# vswitch does not support restart
@ -65,17 +65,17 @@ NOT_RUNNING=7
trap ctrl_c INT
function ctrl_c(){
echo "Exiting ..."
exit 0
function ctrl_c {
echo "Exiting ..."
exit 0
}
DEBUG=false
function dlog {
if [ ${DEBUG} == true ] ; then
echo "Debug: $1"
fi
if [ ${DEBUG} == true ] ; then
echo "Debug: $1"
fi
}
# defaults
@ -91,19 +91,19 @@ FILES=/etc/pmon.d/*
#for file in "pmond" ${FILES}
for file in ${FILES}
do
if [ "${file}" == "pmond" ] ; then
process=${file}
pidfile="/var/run/pmond.pid"
if [ "${file}" == "pmond" ] ; then
process=${file}
pidfile="/var/run/pmond.pid"
else
restarts=`cat ${file} | grep ^restarts | cut -f2 -d'=' | cut -f2 -d' '`
process=`cat ${file} | grep ^process | cut -f2 -d'=' | cut -f2 -d' '`
restarts=`cat ${file} | grep ^restarts | cut -f2 -d'=' | cut -f2 -d' '`
process=`cat ${file} | grep ^process | cut -f2 -d'=' | cut -f2 -d' '`
fi
printf "%-30s %s - " "${process}" "${1}"
# Avoid testing certain processes
# ceph - pmond does not support
# ceph - pmond does not support
if [ "$process" == "ceph" -o "$process" == "vswitch" ] ; then
echo "${process} ${1} is not supported ... skipping"
continue
@ -151,67 +151,67 @@ do
echo "FAILED - process not Running"
fi
elif [ "$1" == "stop" ] ; then
debounce=1
startuptime=1
factor=1
debounce=1
startuptime=1
factor=1
# Not all processes can be stopped
if [ "$process" == "pmond" -o "$process" == "sm" ] ; then
echo "${process} stop not supported ... skipping"
continue
elif [ "$process" == "hbsClient" -a ! -e "/var/run/.node_locked" ] ; then
echo "${process} refusing to stop of heartbeat client on inservice host"
continue
else
pmon-stop ${process}
fi
if [ "$process" == "pmond" -o "$process" == "sm" ] ; then
echo "${process} stop not supported ... skipping"
continue
elif [ "$process" == "hbsClient" -a ! -e "/var/run/.node_locked" ] ; then
echo "${process} refusing to stop of heartbeat client on inservice host"
continue
else
pmon-stop ${process}
fi
elif [ "${1}" == "start" ] ; then
if [ "$process" == "pmond" -o "$process" == "sm" ] ; then
echo "${process} stop not supported ... skipping"
continue
else
factor=1
pmon-start ${process}
sleep 1
s=`tail -2 /var/log/pmond.log | grep "$process process is not in the stopped state"`
if [ ! -z "${s}" ] ; then
echo "FAILED not in stopped state"
continue
fi
fi
if [ "$process" == "pmond" -o "$process" == "sm" ] ; then
echo "${process} stop not supported ... skipping"
continue
else
factor=1
pmon-start ${process}
sleep 1
s=`tail -2 /var/log/pmond.log | grep "$process process is not in the stopped state"`
if [ ! -z "${s}" ] ; then
echo "FAILED not in stopped state"
continue
fi
fi
elif [ "${1}" == "kill" ] ; then
kill -9 ${pid1}
sleep 2
kill -9 ${pid1}
sleep 2
elif [ "${1}" == "alarm" ] ; then
printf "action not yet supported"
continue
printf "action not yet supported"
continue
elif [ "${1}" == "critical" ] ; then
printf "action not yet supported"
continue
printf "action not yet supported"
continue
else
printf "\n\nError:\nInvalid operation '${1}' specified\n"
printf "... must be restart, kill, alarm, or critical\n"
printf "\n"
exit ${UNSUPPORTED_FEATURE}
printf "\n\nError:\nInvalid operation '${1}' specified\n"
printf "... must be restart, kill, alarm, or critical\n"
printf "\n"
exit ${UNSUPPORTED_FEATURE}
fi
sleeptime=$((debounce + startuptime + factor))
sleep $sleeptime
if [ "$1" == "stop" ] ; then
if [ -e "${pidfile}" ] ; then
# some processes are auto restarted by systemd
if [ "${process}" != "mtcClient" -a "${process}" != "syslog-ng" ] ; then
echo "FAILED - pidfile still present"
fi
else
kill -0 ${pid1} 2> /dev/null
if [ $? -eq 0 ] ; then
echo "FAILED - process is still running ($pid1)"
else
pid2=`/usr/sbin/pidof ${process}`
if [ -z ${pid2} ] ; then
echo "PASSED - process is stopped"
if [ -e "${pidfile}" ] ; then
# some processes are auto restarted by systemd
if [ "${process}" != "mtcClient" -a "${process}" != "syslog-ng" ] ; then
echo "FAILED - pidfile still present"
fi
else
kill -0 ${pid1} 2> /dev/null
if [ $? -eq 0 ] ; then
echo "FAILED - process is still running ($pid1)"
else
pid2=`/usr/sbin/pidof ${process}`
if [ -z ${pid2} ] ; then
echo "PASSED - process is stopped"
else
echo "FAILED - process is running again ($pid2)"
echo "FAILED - process is running again ($pid2)"
fi
fi
fi

View File

@ -35,7 +35,7 @@
# 10.10.10.42;10.10.10.43;10.10.10.44;
# 10.10.10.43;
#
# This temporary file is re-created everytime the this script is run. It is used by
# This temporary file is re-created everytime the this script is run. It is used by
# caller of the script to get more detail regarding the NTP servers status.
#
# This script will only be run on the controller nodes.
@ -51,15 +51,15 @@ NTP_SOME_REACHABLE_NONE_SELECTED=4
# is it the ip address of a controller node
isController ()
{
host=$1
res=$(echo $(grep $host /etc/hosts) | grep controller)
host=$1
res=$(echo $(grep $host /etc/hosts) | grep controller)
if [[ "$res" != "" ]] ; then
logger -p info -t $0 "$host is a controller"
return 1
else
return 0
fi
if [[ "$res" != "" ]] ; then
logger -p info -t $0 "$host is a controller"
return 1
else
return 0
fi
}
# loop through all the ntpq servers listed as IPs and get the controller's
@ -71,14 +71,14 @@ getControllerIP ()
do
server=$(echo $line | awk '{print $1;}')
if [[ "$line" != " "* ]] ; then
# if the first char is not a space then remove it e.g +159.203.31.244
server=$(echo $server| cut -c 2-)
# if the first char is not a space then remove it e.g +159.203.31.244
server=$(echo $server| cut -c 2-)
fi
res=$(echo $(grep $server /etc/hosts) | grep controller)
if [[ "$res" != "" ]] ; then
echo $server
return
echo $server
return
fi
done < <(echo "$servers")
@ -98,8 +98,8 @@ bad_server_count=0
# exit if there is no servers provisioned
if [ $server_count -eq 0 ]; then
logger -p info -t $0 "No NTP servers are provisioned (1)"
exit $NTP_NOT_PROVISIONED
logger -p info -t $0 "No NTP servers are provisioned (1)"
exit $NTP_NOT_PROVISIONED
fi
# query the ntp servers with ntpq
@ -132,14 +132,14 @@ while read line
do
server=$(echo $line | awk '{print $1;}')
if [[ "$line" != " "* ]] ; then
# if the first char is not a space then remove it e.g +159.203.31.244
server=$(echo $server| cut -c 2-)
# if the first char is not a space then remove it e.g +159.203.31.244
server=$(echo $server| cut -c 2-)
fi
# add provisioned ntp server to temp file if not the controller
isController $server
if [[ "$?" == 0 ]]; then
echo -n $server";" >> $ntpq_server_info
echo -n $server";" >> $ntpq_server_info
fi
done < <(echo "$server_list")
@ -152,18 +152,18 @@ server_list=$(echo $server_list | grep -v $controller_host_ip)
# list all non reachable ntp servers and save in temp file
while read line
do
if [[ "$line" != "*"* ]] && [[ "$line" != "+"* ]] ;then
if [[ "$line" != "*"* ]] && [[ "$line" != "+"* ]] ;then
server=$(echo $line | awk '{print $1;}')
if [[ "$line" != " "* ]] ; then
# if the first char is not a space then remove it e.g +159.203.31.244
server=$(echo $server| cut -c 2-)
server=$(echo $line | awk '{print $1;}')
if [[ "$line" != " "* ]] ; then
# if the first char is not a space then remove it e.g +159.203.31.244
server=$(echo $server| cut -c 2-)
fi
# add the non reachable external ntp servers to temp file
((bad_server_count++))
echo -n $server";" >> $ntpq_server_info
fi
# add the non reachable external ntp servers to temp file
((bad_server_count++))
echo -n $server";" >> $ntpq_server_info
fi
done < <(echo "$server_list")
IFS=$SAVEIFS
@ -177,32 +177,32 @@ logger -p info -t $0 Total number of unreachable servers $bad_server_count
selected=$(echo "$server_list" | grep -c '^*')
if [ "$bad_server_count" -eq 0 ];then
if [ $selected -eq 0 ]; then
logger -p info -t $0 "All external NTP servers are reachable but none is selected (4)"
exit $NTP_SOME_REACHABLE_NONE_SELECTED
else
logger -p info -t $0 "All external NTP servers are reachable and one is selected (0)"
exit $NTP_OK
fi
if [ $selected -eq 0 ]; then
logger -p info -t $0 "All external NTP servers are reachable but none is selected (4)"
exit $NTP_SOME_REACHABLE_NONE_SELECTED
else
logger -p info -t $0 "All external NTP servers are reachable and one is selected (0)"
exit $NTP_OK
fi
fi
# it does not matter if the peer controller is the server selected, if all the
# external NTP servers are not reachable then we return NTP_NONE_REACHABLE
if [ "$bad_server_count" -eq "$server_count" ];then
logger -p info -t $0 "None of the external NTP servers are reachable (2)"
exit $NTP_NONE_REACHABLE
logger -p info -t $0 "None of the external NTP servers are reachable (2)"
exit $NTP_NONE_REACHABLE
fi
if [ "$bad_server_count" -lt "$server_count" ];then
if [ $selected -eq 0 ]; then
# this will happen if the peer controller is the selected server
logger -p info -t $0 "Some external NTP servers are reachable but none is selected (4)"
exit $NTP_SOME_REACHABLE_NONE_SELECTED
else
logger -p info -t $0 "Some external NTP servers are not reachable and one selected (3)"
exit $NTP_SOME_REACHABLE
fi
if [ $selected -eq 0 ]; then
# this will happen if the peer controller is the selected server
logger -p info -t $0 "Some external NTP servers are reachable but none is selected (4)"
exit $NTP_SOME_REACHABLE_NONE_SELECTED
else
logger -p info -t $0 "Some external NTP servers are not reachable and one selected (3)"
exit $NTP_SOME_REACHABLE
fi
fi
logger -p err -t $0 "Should not exit here"
exit -1
exit -1

View File

@ -10,27 +10,27 @@ source "/etc/init.d/log_functions.sh"
# is it a compute subfunction on a CPE system
isCompute ()
{
[ -f /etc/platform/platform.conf ] || return 0
res=$(grep "subfunction" /etc/platform/platform.conf | grep "controller,compute" | wc -l)
[ -f /etc/platform/platform.conf ] || return 0
res=$(grep "subfunction" /etc/platform/platform.conf | grep "controller,compute" | wc -l)
if [ "$res" -eq 0 ] ; then
return 0
else
return 1
fi
if [ "$res" -eq 0 ] ; then
return 0
else
return 1
fi
}
# only reload rmon if it is a CPE system
isCompute
if [[ "$?" -eq 0 ]]; then
log "Cannot run on a non CPE system."
exit 0
log "Cannot run on a non CPE system."
exit 0
fi
if [ ! -f /var/run/.compute_config_complete ]; then
log "Cannot run prior to compute configuration complete."
exit 0
log "Cannot run prior to compute configuration complete."
exit 0
fi
#################################################################################################

View File

@ -57,14 +57,14 @@ pattern=() # Stores a string indicating the present pattern
function trapCalled {
echo $'\nReceived trap signal' >&2
exit
echo $'\nReceived trap signal' >&2
exit
}
trap trapCalled SIGHUP SIGINT SIGTERM
function helpMessage {
echo "--------------------------------------------------------------------------------------"
echo "--------------------------------------------------------------------------------------"
echo "Memory Leak And Information Tracking Tool"
echo ""
echo "Usage:"
@ -82,7 +82,7 @@ function helpMessage {
echo " /procs/<pid>/smaps"
echo ""
echo " Error logs can be found in /tmp/memchk_err.log"
echo " Standard output can be found in /tmp/memchk_out.log"
echo " Standard output can be found in /tmp/memchk_out.log"
echo ""
echo ""
echo "Examples:"
@ -92,33 +92,33 @@ function helpMessage {
echo "sudo memchk -t 3600 --C pmond rmond hwmond ... Check PSS and RSS values of pmond, rmond and hwmond every 3600s (1h)"
echo "sudo memchl --C pmond rmond hwmond ... Check PSS and RSS values of commands using default period of 3600s (1h)"
echo "--------------------------------------------------------------------------------------"
exit 0
exit 0
}
# Prints information on suspected leaking process
function memLeak {
printf "\n" >&2
printf '%0.1s' "*"{1..150} >&2
# Iterates over all keys in the array.
for proc in ${!leaking[@]}
do
printf "\nPossible mem leak in: %s PID: %s Current RSS: %s Orig RSS: %s Current PSS: %s Orig PSS: %s\n" \
${leaking[proc]} $proc ${rss[proc]} ${firstR[proc]} ${lastP[proc]} ${firstP[proc]} >&2
done
printf '%0.1s' "*"{1..150} >&2
printf "\n" >&2
printf "\n" >&2
printf '%0.1s' "*"{1..150} >&2
# Iterates over all keys in the array.
for proc in ${!leaking[@]}
do
printf "\nPossible mem leak in: %s PID: %s Current RSS: %s Orig RSS: %s Current PSS: %s Orig PSS: %s\n" \
${leaking[proc]} $proc ${rss[proc]} ${firstR[proc]} ${lastP[proc]} ${firstP[proc]} >&2
done
printf '%0.1s' "*"{1..150} >&2
printf "\n" >&2
}
if [ $UID -ne 0 ]; then
echo $'\nWarning: Memchk must be run as \'root\' user to access PSS memory information'
echo $'Use the -h option for help\n'
exit 1
echo $'\nWarning: Memchk must be run as \'root\' user to access PSS memory information'
echo $'Use the -h option for help\n'
exit 1
fi
if [ $# -eq 0 ]; then
echo $'\nNo commands specified\nPlease try again and enter a command whose memory you would like to monitor'
echo $'Use the -h option for help\n'
exit 1
echo $'\nNo commands specified\nPlease try again and enter a command whose memory you would like to monitor'
echo $'Use the -h option for help\n'
exit 1
fi
exec > >(tee /tmp/NEWmemchk_out.log) 2> >(tee /tmp/NEWmemchk_err.log >&2)
@ -138,16 +138,16 @@ while [[ $# > 0 ]]; do
shift
;;
--C)
shift
if [ "$#" -eq "0" ]; then
printf "Error: No commands specified.\n"
exit 1
fi
for c in "$@"; do
commands+=("$1")
shift
done
--C)
shift
if [ "$#" -eq "0" ]; then
printf "Error: No commands specified.\n"
exit 1
fi
for c in "$@"; do
commands+=("$1")
shift
done
;;
-h|--help)
@ -164,58 +164,62 @@ done
# Makes sure period has a positive value
if [ "$period" -le "0" ]; then
period=3600
printf "You have entered an invalid period. Period has been set to 3600 seconds.\n"
period=3600
printf "You have entered an invalid period. Period has been set to 3600 seconds.\n"
# The rate of kB/h has been hard-coded into the table, if values greater than or equal to 1 hour are used, the table
# will not show an accurate representation in the change in usage over time. There are various accuracy issues in
# modifying the code to display data to match your chosen period. Consider this and modify accordingly.
elif [ "$period" -lt "3600" ]; then
printf "\nWARNING: You have chosen a period that is less than 1 hour. The rate of change in the table is displayed in kB/h, keep this in mind when reviewing results.\n"
printf "\nWARNING: You have chosen a period that is less than 1 hour. The rate of change in the table is displayed in kB/h, keep this in mind when reviewing results.\n"
fi
while true; do
# Prints header for columns
printf "\n%15s | %8s | Leak | %10s | %13s | %8s | %8s | %8s | %13s | %8s | %8s | %8s | Period: %-${#period}ss\n" \
"Cmd" "PID" "Trend" "Change in RSS" "RSS" "Orig RSS" "Prev RSS" "Change in PSS" "PSS" "Orig PSS" "Prev PSS" "$period" >&1
padding=$(printf '%0.1s' "-"{1..180})
printf '%*.*s' 0 $((156 + ${#period} )) "$padding" # Prints line of hyphens of variable size depending on the number of characters in period.
# Cycles through each of the originally entered commands. This list does not change.
for cmd in ${commands[@]}
do
# Finds all the PIDs associated with each command (commands may have more than one instance)
procs="$(pgrep $cmd)"
# Prints header for columns
printf "\n%15s | %8s | Leak | %10s | %13s | %8s | %8s | %8s | %13s | %8s | %8s | %8s | Period: %-${#period}ss\n" \
"Cmd" "PID" "Trend" "Change in RSS" "RSS" "Orig RSS" "Prev RSS" "Change in PSS" "PSS" "Orig PSS" "Prev PSS" "$period" >&1
padding=$(printf '%0.1s' "-"{1..180})
printf '%*.*s' 0 $((156 + ${#period} )) "$padding" # Prints line of hyphens of variable size depending on the number of characters in period.
# Cycles through each of the originally entered commands. This list does not change.
for cmd in ${commands[@]}
do
# Finds all the PIDs associated with each command (commands may have more than one instance)
procs="$(pgrep $cmd)"
# The number of processes may change on each loop. Keep this in mind if expanding or reusing this script.
for pid in ${procs[@]}
do
# In smaps the PSS value is located 3 lines below the line containing the process name. This works by setting
# the awk variable comm to contain the same value as cmd, the file is then searched for the string pattern
# contained in comm (cmd) and the PSS value associated with each instance of comm is summed and then printed.
pss=$(awk -v comm="$cmd" '$0 ~ comm {getline;getline;getline;sum += $2;} END {print sum}' /proc/"$pid"/smaps)
# obtains the RSS value of the indicated process
rssCurrent=$(ps -p "$pid" --no-header -o rss)
lastR[pid]="${rss[pid]}"
# The number of processes may change on each loop. Keep this in mind if expanding or reusing this script.
for pid in ${procs[@]}
do
# In smaps the PSS value is located 3 lines below the line containing the process name. This works by setting
# the awk variable comm to contain the same value as cmd, the file is then searched for the string pattern
# contained in comm (cmd) and the PSS value associated with each instance of comm is summed and then printed.
pss=$(awk -v comm="$cmd" '$0 ~ comm {getline;getline;getline;sum += $2;} END {print sum}' /proc/"$pid"/smaps)
# obtains the RSS value of the indicated process
rssCurrent=$(ps -p "$pid" --no-header -o rss)
lastR[pid]="${rss[pid]}"
# Child processes may exist ephemerally, as a result they may be added to our list of PIDs, but no longer
# exist when we try to read their associated files in /proc/. This makes sure the file exists and that the
# parent process is 1. If the parent process ID is not 1 then the process in question is a child proceess
# and we do not care about its memory usage (for the purposes of this specific script). The continue
# statement will return us to the for-loop and begin running for the next pid.
if [ -f "/proc/$pid/status" ] && [ "$(awk '$0 ~ "PPid:" {print $2}' /proc/"$pid"/status)" -ne "1" ]; then continue; fi
# Child processes may exist ephemerally, as a result they may be added to our list of PIDs, but no longer
# exist when we try to read their associated files in /proc/. This makes sure the file exists and that the
# parent process is 1. If the parent process ID is not 1 then the process in question is a child proceess
# and we do not care about its memory usage (for the purposes of this specific script). The continue
# statement will return us to the for-loop and begin running for the next pid.
if [ -f "/proc/$pid/status" ] && [ "$(awk '$0 ~ "PPid:" {print $2}' /proc/"$pid"/status)" -ne "1" ];then
continue;
fi
# This checks that neither rssCurrent nor pss have empty values due to a child process being generated
# and then killed off before its values could be read. Root occasionally generates a child process of
# one of the monitored commands so the above if-statement doesn't exclude it because the PPID is 1.
if [ -z "$rssCurrent" ] || [ -z "$pss" ]; then continue; fi
# This checks that neither rssCurrent nor pss have empty values due to a child process being generated
# and then killed off before its values could be read. Root occasionally generates a child process of
# one of the monitored commands so the above if-statement doesn't exclude it because the PPID is 1.
if [ -z "$rssCurrent" ] || [ -z "$pss" ]; then
continue;
fi
# Sets initial values for PSS and RSS. NA is set instead of 0 because using numbers could lead to false
# or inaccurate information. It also previously allowed one to see when child processes were spawned.
if [ "$flag" -ne "1" ]; then
firstP[pid]="$pss"
lastP[pid]="NA"
rss[pid]="$rssCurrent"
firstR[pid]="${rss[pid]}"
lastR[pid]="NA"
# Sets initial values for PSS and RSS. NA is set instead of 0 because using numbers could lead to false
# or inaccurate information. It also previously allowed one to see when child processes were spawned.
if [ "$flag" -ne "1" ]; then
firstP[pid]="$pss"
lastP[pid]="NA"
rss[pid]="$rssCurrent"
firstR[pid]="${rss[pid]}"
lastR[pid]="NA"
s1[pid]=""
s2[pid]=""
trend[pid]=0
@ -224,30 +228,36 @@ while true; do
stable[pid]=0
count[pid]=0
baseline[pid]=0
fi
fi
# In the event of a memory leak (the RSS value increasing), an X is placed in the 'Leak' column of the
# printed table. The PID of the process is also added to an array to be sent to the memLeak function
# once all of the commands' processes have been checked. A flag indicating that a possible leak has
# been detected is also set.
if [ "${rss[pid]}" -lt "$rssCurrent" ]; then
lastR[pid]="${rss[pid]}"
rss[pid]="$rssCurrent"
leaking[pid]="$cmd"
leak[pid]="X"
let leakFlag=1
fi
# In the event of a memory leak (the RSS value increasing), an X is placed in the 'Leak' column of the
# printed table. The PID of the process is also added to an array to be sent to the memLeak function
# once all of the commands' processes have been checked. A flag indicating that a possible leak has
# been detected is also set.
if [ "${rss[pid]}" -lt "$rssCurrent" ]; then
lastR[pid]="${rss[pid]}"
rss[pid]="$rssCurrent"
leaking[pid]="$cmd"
leak[pid]="X"
let leakFlag=1
fi
# Calculates the changes in PSS and RSS usage over time. If this is the first run and there is no
# previous value with which to compare against, delta is set to 0, where delta is the change over
# time.
if [ "${lastP[pid]}" = "NA" ]; then changeP[$pid]=0; deltaP=0.000;
else changeP[pid]="$((changeP[$pid] + $pss - lastP[$pid]))"; deltaP=$(awk -v chP="${changeP[$pid]}" -v hrs="${hours}" -v t="${period}" 'BEGIN {printf "%.3f", (chP/(hrs*t))*3600; exit(0)}');
fi
# Calculates the changes in PSS and RSS usage over time. If this is the first run and there is no
# previous value with which to compare against, delta is set to 0, where delta is the change over
# time.
if [ "${lastP[pid]}" = "NA" ]; then
changeP[$pid]=0; deltaP=0.000;
else
changeP[pid]="$((changeP[$pid] + $pss - lastP[$pid]))";
deltaP=$(awk -v chP="${changeP[$pid]}" -v hrs="${hours}" -v t="${period}" 'BEGIN {printf "%.3f", (chP/(hrs*t))*3600; exit(0)}');
fi
if [ "${lastR[pid]}" = "NA" ]; then changeR[$pid]=0; deltaR=0.000;
else changeR[pid]="$((changeR[$pid] + rss[$pid] - lastR[$pid]))"; deltaR=$(awk -v chR="${changeR[$pid]}" -v hrs="${hours}" -v t="${period}" 'BEGIN {printf "%.3f", (chR/(hrs*t))*3600; exit(0)}');
fi
if [ "${lastR[pid]}" = "NA" ]; then
changeR[$pid]=0; deltaR=0.000;
else
changeR[pid]="$((changeR[$pid] + rss[$pid] - lastR[$pid]))";
deltaR=$(awk -v chR="${changeR[$pid]}" -v hrs="${hours}" -v t="${period}" 'BEGIN {printf "%.3f", (chR/(hrs*t))*3600; exit(0)}');
fi
# The below if-else block seeks to determine gradual sustained patterns of RSS usage over time to determine if the memory usage is gradually
# increasing throughout the lifespan of the process (possible memory leak) or not. Non-gradual usage changes can be due to dynamic reallocation
@ -279,80 +289,82 @@ while true; do
# A trend cannot change immediately from increasing to decreasing. This is done to avoid representing erratic behaviour as a long-term pattern.
# An increasing or decreasing trend must change to 'none' -- no trend observed -- before the opposite trend can be declared.
# The baseline average is the RSS values for a PID from each sample added together and divided by the number of samples that have taken place.
let count[pid]+=1
let baseline[pid]+="$rssCurrent"
let count[pid]+=1
let baseline[pid]+="$rssCurrent"
avg=$(awk -v b="${baseline[pid]}" -v c="${count[pid]}" 'BEGIN {printf "%.0f", (b/c); exit(0)}')
if [ "${trend[pid]}" -ge "3" ]; then
if [ "${rss[pid]}" -gt "$avg" ] && ([ "${s1[pid]}" = "increasing" ] || ([ "${s1[pid]}" != "decreasing" ] && [ "${s2[pid]}" != "decreasing" ]) && [ "${stable[pid]}" -ne "3" ]); then
if [ "${s1[pid]}" != "increasing" ]; then
s2[pid]="${s1[pid]}"
s1[pid]="increasing"
fi
elif [ "${rss[pid]}" -eq "$avg" ]; then
if [ "${s1[pid]}" != "stable" ]; then
stable[pid]=0
s2[pid]="${s1[pid]}"
s1[pid]="stable"
fi
if [ "${trend[pid]}" -ge "3" ]; then
if [ "${rss[pid]}" -gt "$avg" ] && ([ "${s1[pid]}" = "increasing" ] || ([ "${s1[pid]}" != "decreasing" ] && [ "${s2[pid]}" != "decreasing" ]) && [ "${stable[pid]}" -ne "3" ]); then
if [ "${s1[pid]}" != "increasing" ]; then
s2[pid]="${s1[pid]}"
s1[pid]="increasing"
fi
elif [ "${rss[pid]}" -eq "$avg" ]; then
if [ "${s1[pid]}" != "stable" ]; then
stable[pid]=0
s2[pid]="${s1[pid]}"
s1[pid]="stable"
fi
let stable[pid]+=1
let stable[pid]+=1
elif [ "${rss[pid]}" -lt "$avg" ] && ([ "${s1[pid]}" = "decreasing" ] || ([ "${s1[pid]}" != "increasing" ] && [ "${s2[pid]}" != "increasing" ]) && [ "${stable[pid]}" -ne "3" ]); then
if [ "${s1[pid]}" != "decreasing" ]; then
s2[pid]="${s1[pid]}"
s1[pid]="decreasing"
fi
else
s1[pid]=""
s2[pid]=""
trend[pid]=0
increasing[pid]=0
decreasing[pid]=0
stable[pid]=0
fi
let stable[pid]+=1
elif [ "${rss[pid]}" -lt "$avg" ] && ([ "${s1[pid]}" = "decreasing" ] || ([ "${s1[pid]}" != "increasing" ] && [ "${s2[pid]}" != "increasing" ]) && [ "${stable[pid]}" -ne "3" ]); then
if [ "${s1[pid]}" != "decreasing" ]; then
s2[pid]="${s1[pid]}"
s1[pid]="decreasing"
fi
else
s1[pid]=""
s2[pid]=""
trend[pid]=0
increasing[pid]=0
decreasing[pid]=0
stable[pid]=0
fi
# This else-block is used to establish whether or not a trend has been established. It waits for a pattern of the RSS value of a PID to increase,
# decrease, or remain stable relative to the baseline average three times in a row before it will declare that a trend exists. This is to avoid
# viewing erratic increases and decreases in RSS as gradual increases or decreases in the system's (process') RSS usage.
else
else
if [ "${count[pid]}" -gt "0" ]; then
if [ "${rss[pid]}" -gt "$avg" ]; then
let trend[pid]+=1
let increasing[pid]+=1
s1[pid]="increasing"
elif [ "${rss[pid]}" -eq "$avg" ]; then
let trend[pid]+=1
let stable[pid]+=1
s1[pid]="stable"
elif [ "${rss[pid]}" -lt "$avg" ]; then
let trend[pid]+=1
let decreasing[pid]+=1
s1[pid]="decreasing"
fi
if [ "${increasing[pid]}" -gt "0" ] && [ "${decreasing[pid]}" -gt "0" ]; then
increasing[pid]=0
decreasing[pid]=0
stable[pid]=0
trend[pid]=0
fi
if [ "${rss[pid]}" -gt "$avg" ]; then
let trend[pid]+=1
let increasing[pid]+=1
s1[pid]="increasing"
elif [ "${rss[pid]}" -eq "$avg" ]; then
let trend[pid]+=1
let stable[pid]+=1
s1[pid]="stable"
elif [ "${rss[pid]}" -lt "$avg" ]; then
let trend[pid]+=1
let decreasing[pid]+=1
s1[pid]="decreasing"
fi
if [ "${increasing[pid]}" -gt "0" ] && [ "${decreasing[pid]}" -gt "0" ]; then
increasing[pid]=0
decreasing[pid]=0
stable[pid]=0
trend[pid]=0
fi
fi
fi
fi
if [ "${trend[pid]}" -ge "3" ]; then pattern[pid]="${s1[pid]}"; else pattern[pid]="none"; fi # Sets the trend variable for printing if a trend exists
printf "\n%15s | %8s | %2s | %10s | %8s kB/h | %8s | %8s | %8s | %8s kB/h | %8s | %8s | %8s |" \
$cmd $pid "${leak[pid]}" "${pattern[pid]}" $deltaR ${rss[pid]} ${firstR[pid]} ${lastR[pid]} $deltaP $pss ${firstP[pid]} ${lastP[pid]} >&1
lastP[pid]="$pss"
leak[pid]="" # Resets the indicator in the 'Leak' column
if [ "${trend[pid]}" -ge "3" ]; then
pattern[pid]="${s1[pid]}";
else
pattern[pid]="none";
fi # Sets the trend variable for printing if a trend exists
printf "\n%15s | %8s | %2s | %10s | %8s kB/h | %8s | %8s | %8s | %8s kB/h | %8s | %8s | %8s |" \
$cmd $pid "${leak[pid]}" "${pattern[pid]}" $deltaR ${rss[pid]} ${firstR[pid]} ${lastR[pid]} $deltaP $pss ${firstP[pid]} ${lastP[pid]} >&1
lastP[pid]="$pss"
leak[pid]="" # Resets the indicator in the 'Leak' column
done
done
if [ "$leakFlag" -eq "1" ]; then memLeak leaking[@]; fi # Calls the mem leak function if flag is set
unset leaking[@] # Clear the array holding PIDs of processes with potential leaks
let leakFlag=0
let hours+=1 # Hour count[pid]er used in calculating delta
let flag=1 # Flag indicating that first run has completed so we no longer have to set values of 'NA'
echo $'\n'
sleep "$period"
if [ "$leakFlag" -eq "1" ]; then
memLeak leaking[@];
fi # Calls the mem leak function if flag is set
unset leaking[@] # Clear the array holding PIDs of processes with potential leaks
let leakFlag=0
let hours+=1 # Hour count[pid]er used in calculating delta
let flag=1 # Flag indicating that first run has completed so we no longer have to set values of 'NA'
echo $'\n'
sleep "$period"
done

View File

@ -3,7 +3,7 @@
#
### BEGIN INIT INFO
# Provides: hwclock
# Required-Start:
# Required-Start:
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
@ -29,64 +29,56 @@
[ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime"
case "$1" in
start)
if [ "$VERBOSE" != no ]
then
echo "System time was `date`."
echo "Setting the System Clock using the Hardware Clock as reference..."
fi
start)
if [ "$VERBOSE" != no ] ;then
echo "System time was `date`."
echo "Setting the System Clock using the Hardware Clock as reference..."
fi
if [ "$HWCLOCKACCESS" != no ]
then
if [ -z "$TZ" ]
then
hwclock $tz --hctosys
else
TZ="$TZ" hwclock $tz --hctosys
fi
fi
if [ "$HWCLOCKACCESS" != no ] ;then
if [ -z "$TZ" ] ;then
hwclock $tz --hctosys
else
TZ="$TZ" hwclock $tz --hctosys
fi
fi
if [ "$VERBOSE" != no ]
then
echo "System Clock set. System local time is now `date`."
fi
;;
stop|restart|reload|force-reload)
#
# Updates the Hardware Clock with the System Clock time.
# This will *override* any changes made to the Hardware Clock.
#
# WARNING: If you disable this, any changes to the system
# clock will not be carried across reboots.
#
if [ "$VERBOSE" != no ]
then
echo "Saving the System Clock time to the Hardware Clock..."
fi
if [ "$HWCLOCKACCESS" != no ]
then
hwclock $tz --systohc
fi
if [ "$VERBOSE" != no ]
then
echo "Hardware Clock updated to `date`."
fi
exit 0
;;
show)
if [ "$HWCLOCKACCESS" != no ]
then
hwclock $tz --show
fi
;;
status)
stiatus hwclock
exit $?
;;
*)
echo "Usage: hwclock.sh {start|stop|status|show|reload|restart}" >&2
echo " start sets kernel (system) clock from hardware (RTC) clock" >&2
echo " stop and reload set hardware (RTC) clock from kernel (system) clock" >&2
exit 1
;;
if [ "$VERBOSE" != no ]; then
echo "System Clock set. System local time is now `date`."
fi
;;
stop|restart|reload|force-reload)
#
# Updates the Hardware Clock with the System Clock time.
# This will *override* any changes made to the Hardware Clock.
#
# WARNING: If you disable this, any changes to the system
# clock will not be carried across reboots.
#
if [ "$VERBOSE" != no ]; then
echo "Saving the System Clock time to the Hardware Clock..."
fi
if [ "$HWCLOCKACCESS" != no ]; then
hwclock $tz --systohc
fi
if [ "$VERBOSE" != no ]; then
echo "Hardware Clock updated to `date`."
fi
exit 0
;;
show)
if [ "$HWCLOCKACCESS" != no ]; then
hwclock $tz --show
fi
;;
status)
stiatus hwclock
exit $?
;;
*)
echo "Usage: hwclock.sh {start|stop|status|show|reload|restart}" >&2
echo " start sets kernel (system) clock from hardware (RTC) clock" >&2
echo " stop and reload set hardware (RTC) clock from kernel (system) clock" >&2
exit 1
;;
esac

View File

@ -13,61 +13,61 @@ primary_resource="sysinv-api"
proc="Platform RA Soak:"
count=0
delay_list="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
while true
do
logger "$proc Stopping Platform Resource Agents ----------"
crm resource stop $primary_resource
for delay in $delay_list
do
sleep 1
echo -n "."
done
echo ""
logger "$proc Stopping Platform Resource Agents ----------"
crm resource stop $primary_resource
for delay in $delay_list
do
sleep 1
echo -n "."
done
echo ""
status=`crm resource status`
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
do
status_tmp=`echo "$status" | grep $service | cut -f2 -d')'`
if [ "$status_tmp" != " Stopped " ] ; then
echo "$proc ($count) Stop $service Failed <$status_tmp>"
sleep 5
crm resource status
exit 0
else
echo "$proc ($count) Stop O.K. for $service"
fi
done
logger "$proc Stop O.K. -------------------------------"
status=`crm resource status`
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
do
status_tmp=`echo "$status" | grep $service | cut -f2 -d')'`
if [ "$status_tmp" != " Stopped " ] ; then
echo "$proc ($count) Stop $service Failed <$status_tmp>"
sleep 5
crm resource status
exit 0
else
echo "$proc ($count) Stop O.K. for $service"
fi
done
logger "$proc Stop O.K. -------------------------------"
logger "$proc Starting Platform Resource Agents ----------"
crm resource start $primary_resource
for delay in $delay_list
do
sleep 1
echo -n "."
done
echo ""
logger "$proc Starting Platform Resource Agents ----------"
crm resource start $primary_resource
for delay in $delay_list
do
sleep 1
echo -n "."
done
echo ""
status=`crm resource status`
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
do
status_tmp=`echo "$status" | grep $service | cut -f2 -d')'`
if [ "$status_tmp" != " Started " ] ; then
echo "$proc ($count) Start $service Failed <$status_tmp>"
sleep 5
crm resource status
exit 0
else
echo "$proc ($count) Start O.K. for $service"
fi
done
logger "$proc Start O.K. ------------------------------"
status=`crm resource status`
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
do
status_tmp=`echo "$status" | grep $service | cut -f2 -d')'`
if [ "$status_tmp" != " Started " ] ; then
echo "$proc ($count) Start $service Failed <$status_tmp>"
sleep 5
crm resource status
exit 0
else
echo "$proc ($count) Start O.K. for $service"
fi
done
logger "$proc Start O.K. ------------------------------"
count=`expr $count + 1`
mtc=`cat /var/run/mtcAgent.pid`
hbs=`cat /var/run/hbsAgent.pid`
echo "$mtc:`pidof mtcAgent` <:> $hbs:`pidof hbsAgent`"
count=`expr $count + 1`
mtc=`cat /var/run/mtcAgent.pid`
hbs=`cat /var/run/hbsAgent.pid`
echo "$mtc:`pidof mtcAgent` <:> $hbs:`pidof hbsAgent`"
done

View File

@ -13,27 +13,27 @@ primary_resource="svr_vip"
proc="Openstack Swact Soak:"
count=0
delay_list="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
while true
do
logger "$proc Swacting to Controller 1 ----------"
crm resource move $primary_resource controller-1
for delay in $delay_list
do
sleep 10
echo -n "."
crm status
done
logger "$proc Swacting to Controller 1 ----------"
crm resource move $primary_resource controller-1
for delay in $delay_list
do
sleep 10
echo -n "."
crm status
done
logger "$proc Swacting to Controller 0 ----------"
crm resource move $primary_resource controller-0
for delay in $delay_list
do
sleep 10
echo -n "."
crm status
done
logger "$proc Swacting to Controller 0 ----------"
crm resource move $primary_resource controller-0
for delay in $delay_list
do
sleep 10
echo -n "."
crm status
done
done

View File

@ -20,7 +20,7 @@ GENERIC_ERROR=1
NOVA_GOENABLED_TAG=${NOVA_GOENABLED_TAG:-"NOVA_GOENABLED"}
function log
log()
{
logger -p local1.info -t ${NOVA_GOENABLED_TAG} $@
}
@ -32,22 +32,18 @@ NOVA_ADVANCE_ENABLED="/var/run/.nova_timer_advance_enabled"
case "$1" in
start)
if [ -e ${VOLATILE_COMPUTE_CONFIG_COMPLETE} ] && [ ! -e ${VOLATILE_DISABLE_COMPUTE_SERVICES} ]
then
if [ -e ${VOLATILE_COMPUTE_CONFIG_COMPLETE} ] && [ ! -e ${VOLATILE_DISABLE_COMPUTE_SERVICES} ]; then
log "Start"
if [ -e ${NOVA_INIT_FAILED} ]
then
if [ -e ${NOVA_INIT_FAILED} ]; then
log "Nova-Init check FAILED"
exit ${GENERIC_ERROR}
fi
log "Nova-Init check PASSED"
while :
do
if [ -e ${NOVA_ADVANCE_ENABLED} ]
then
while [ true ]; do
if [ -e ${NOVA_ADVANCE_ENABLED} ]; then
log "Nova setup timer advance PASSED"
break
fi
@ -55,10 +51,8 @@ case "$1" in
sleep 1
done
while :
do
if [ -e ${NOVA_COMPUTE_ENABLED} ]
then
while [ true ]; do
if [ -e ${NOVA_COMPUTE_ENABLED} ]; then
log "Nova-Compute service enabled PASSED"
break
fi

View File

@ -9,7 +9,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
NAME=$(basename $0)
function LOG()
LOG()
{
logger "$NAME: $*"
}
@ -47,8 +47,7 @@ REASONS=$(virt-host-validate qemu 2>/dev/null | grep -w -e FAIL)
# - on emulated systems such as VirtualBox or QEMU, vmx is not required
# - if vmx is enabled on QEMU, it can also support nested virtualization
if [ "${host_type}" = "physical" ] && [ "${hardware_virt_supported}" == "false" ]
then
if [ "${host_type}" = "physical" ] && [ "${hardware_virt_supported}" == "false" ]; then
LOG "Virtualization is not supported: ${OPTS}. Failing goenabled check."
LOG "Failure reasons:"$'\n'"${REASONS}"
exit 1

View File

@ -14,6 +14,9 @@ deps = -r{toxinidir}/test-requirements.txt
[testenv:linters]
whitelist_externals = bash
#bashate ignore errors
#E010: do not on the same line as for
#E006 Line too long
commands =
bash -c "find {toxinidir} \
-not \( -type d -name .?\* -prune \) \
@ -21,7 +24,7 @@ commands =
-not -name \*~ \
-not -name \*.md \
-name \*.sh \
-print0 | xargs -0 bashate -v"
-print0 | xargs -0 bashate -v -i E010,E006"
bash -c "find {toxinidir} \
\( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \
-o \( -name .tox -prune \) \