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:
parent
82e851d651
commit
fedb95ba79
@ -4,3 +4,7 @@
|
|||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-pep8:
|
- openstack-tox-pep8:
|
||||||
voting: false
|
voting: false
|
||||||
|
- openstack-tox-linters
|
||||||
|
gate:
|
||||||
|
jobs:
|
||||||
|
- openstack-tox-linters
|
||||||
|
@ -8,64 +8,64 @@ WORKING_DIR=""
|
|||||||
COPY_DIR=""
|
COPY_DIR=""
|
||||||
ISODIR=$(dirname `readlink -f $0`)
|
ISODIR=$(dirname `readlink -f $0`)
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 -u <http base URL> [-t <tftp pxeboot directory>] or [-w <working directory>]" 1>&2;
|
echo "Usage: $0 -u <http base URL> [-t <tftp pxeboot directory>] or [-w <working directory>]" 1>&2;
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":u:t:w:" opt; do
|
while getopts ":u:t:w:" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
u)
|
u)
|
||||||
BASE_URL=${OPTARG}
|
BASE_URL=${OPTARG}
|
||||||
;;
|
;;
|
||||||
t)
|
t)
|
||||||
TFTP_DIR=${OPTARG}
|
TFTP_DIR=${OPTARG}
|
||||||
;;
|
;;
|
||||||
w)
|
w)
|
||||||
WORKING_DIR=${OPTARG}
|
WORKING_DIR=${OPTARG}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
if [ -z "$BASE_URL" ]; then
|
if [ -z "$BASE_URL" ]; then
|
||||||
echo "HTTP base URL is required: -u <http base URL>"
|
echo "HTTP base URL is required: -u <http base URL>"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$TFTP_DIR" ] && [ -z "$WORKING_DIR" ]; then
|
if [ -z "$TFTP_DIR" ] && [ -z "$WORKING_DIR" ]; then
|
||||||
echo "Either tftp pxeboot directory or working directory has to be specified:"
|
echo "Either tftp pxeboot directory or working directory has to be specified:"
|
||||||
echo "-t <tftp pxeboot directory> or -w <working directory>"
|
echo "-t <tftp pxeboot directory> or -w <working directory>"
|
||||||
exit 0
|
exit 0
|
||||||
elif [ -n "$TFTP_DIR" ]; then
|
elif [ -n "$TFTP_DIR" ]; then
|
||||||
if [ -n "$WORKING_DIR" ]; then
|
if [ -n "$WORKING_DIR" ]; then
|
||||||
echo "tftp pxeboot directory is supplied, working directory will be ignored."
|
echo "tftp pxeboot directory is supplied, working directory will be ignored."
|
||||||
fi
|
fi
|
||||||
COPY_DIR=$TFTP_DIR
|
COPY_DIR=$TFTP_DIR
|
||||||
elif [ -n "$WORKING_DIR" ]; then
|
elif [ -n "$WORKING_DIR" ]; then
|
||||||
COPY_DIR=$WORKING_DIR
|
COPY_DIR=$WORKING_DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d ${COPY_DIR} ] ; then
|
if [ ! -d ${COPY_DIR} ] ; then
|
||||||
if [ -w "$(dirname $COPY_DIR)" ]; then
|
if [ -w "$(dirname $COPY_DIR)" ]; then
|
||||||
echo "Create ${COPY_DIR}"
|
echo "Create ${COPY_DIR}"
|
||||||
mkdir ${COPY_DIR}
|
mkdir ${COPY_DIR}
|
||||||
chmod +w ${COPY_DIR}
|
chmod +w ${COPY_DIR}
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Can't create ${COPY_DIR}"
|
echo "Can't create ${COPY_DIR}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "$COPY_DIR parent directory is not writeable."
|
echo "$COPY_DIR parent directory is not writeable."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "$COPY_DIR already exists"
|
echo "$COPY_DIR already exists"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Copy the vmlinuz and initrd files to the destination directory
|
#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
|
rm -Rf ${COPY_DIR}/pxeboot
|
||||||
|
|
||||||
if [ -n "$TFTP_DIR" ]; then
|
if [ -n "$TFTP_DIR" ]; then
|
||||||
#Create pxelinux.cfg directory and default link
|
#Create pxelinux.cfg directory and default link
|
||||||
mkdir ${TFTP_DIR}/pxelinux.cfg
|
mkdir ${TFTP_DIR}/pxelinux.cfg
|
||||||
chmod 755 ${TFTP_DIR}/pxelinux.cfg
|
chmod 755 ${TFTP_DIR}/pxelinux.cfg
|
||||||
ln -s ../pxeboot.cfg ${TFTP_DIR}/pxelinux.cfg/default
|
ln -s ../pxeboot.cfg ${TFTP_DIR}/pxelinux.cfg/default
|
||||||
fi
|
fi
|
||||||
|
@ -16,18 +16,18 @@ set -x
|
|||||||
echo "$(date): Starting execution: $0 $@"
|
echo "$(date): Starting execution: $0 $@"
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
rm -rf $TMP_RPM
|
rm -rf $TMP_RPM
|
||||||
}
|
}
|
||||||
rollback() {
|
rollback() {
|
||||||
rm -rf $FEED_DIR
|
rm -rf $FEED_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
error() {
|
error() {
|
||||||
local parent_lineno="$1"
|
local parent_lineno="$1"
|
||||||
local err_code="${2}"
|
local err_code="${2}"
|
||||||
echo "Error executing import script at line: ${parent_lineno} with error code: ${err_code}"
|
echo "Error executing import script at line: ${parent_lineno} with error code: ${err_code}"
|
||||||
rollback
|
rollback
|
||||||
exit "${err_code}"
|
exit "${err_code}"
|
||||||
}
|
}
|
||||||
|
|
||||||
trap 'error ${LINENO} $?' ERR
|
trap 'error ${LINENO} $?' ERR
|
||||||
|
@ -14,8 +14,7 @@
|
|||||||
# -o /pxeboot/pxelinux.cfg/01-08-00-27-3e-f8-05 -b sda -r sda -t -c ttyS0,115200
|
# -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
|
cat >&2 <<EOF
|
||||||
$0: This utility is used to generate a node-specific pxeboot.cfg file
|
$0: This utility is used to generate a node-specific pxeboot.cfg file
|
||||||
|
|
||||||
@ -37,33 +36,28 @@ EOF
|
|||||||
|
|
||||||
declare text_install="inst.text"
|
declare text_install="inst.text"
|
||||||
|
|
||||||
function generate_config()
|
function generate_config {
|
||||||
{
|
|
||||||
input=$1
|
input=$1
|
||||||
output=$2
|
output=$2
|
||||||
|
|
||||||
if [ ! -f "$input" ]
|
if [ ! -f "$input" ]; then
|
||||||
then
|
|
||||||
logger --stderr -t $0 "Error: Input file $input does not exist"
|
logger --stderr -t $0 "Error: Input file $input does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -w $(dirname $output) ]
|
if [ ! -w $(dirname $output) ]; then
|
||||||
then
|
|
||||||
logger --stderr -t $0 "Error: Destination directory $(dirname $output) not writeable"
|
logger --stderr -t $0 "Error: Destination directory $(dirname $output) not writeable"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e $output -a ! -w $output ]
|
if [ -e $output -a ! -w $output ]; then
|
||||||
then
|
|
||||||
logger --stderr -t $0 "Error: Destination file $output_file_efi exists and is not writeable"
|
logger --stderr -t $0 "Error: Destination file $output_file_efi exists and is not writeable"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -e "s#xxxAPPEND_OPTIONSxxx#$APPEND_OPTIONS#" $input > $output
|
sed -e "s#xxxAPPEND_OPTIONSxxx#$APPEND_OPTIONS#" $input > $output
|
||||||
|
|
||||||
if [ $? -ne 0 -o ! -f $output ]
|
if [ $? -ne 0 -o ! -f $output ]; then
|
||||||
then
|
|
||||||
logger --stderr -t $0 "Error: Failed to generate pxeboot file $output"
|
logger --stderr -t $0 "Error: Failed to generate pxeboot file $output"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -126,12 +120,11 @@ done
|
|||||||
|
|
||||||
# Validate parameters
|
# Validate parameters
|
||||||
if [ -z "$input_file" \
|
if [ -z "$input_file" \
|
||||||
-o -z "$input_file_efi" \
|
-o -z "$input_file_efi" \
|
||||||
-o -z "$output_file" \
|
-o -z "$output_file" \
|
||||||
-o -z "$output_file_efi" \
|
-o -z "$output_file_efi" \
|
||||||
-o -z "$boot_device" \
|
-o -z "$boot_device" \
|
||||||
-o -z "$rootfs_device" ]
|
-o -z "$rootfs_device" ]; then
|
||||||
then
|
|
||||||
logger --stderr -t $0 "Error: One or more mandatory options not specified: $@"
|
logger --stderr -t $0 "Error: One or more mandatory options not specified: $@"
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
@ -139,18 +132,15 @@ fi
|
|||||||
|
|
||||||
APPEND_OPTIONS="boot_device=$boot_device rootfs_device=$rootfs_device"
|
APPEND_OPTIONS="boot_device=$boot_device rootfs_device=$rootfs_device"
|
||||||
|
|
||||||
if [ -n "$text_install" ]
|
if [ -n "$text_install" ]; then
|
||||||
then
|
|
||||||
APPEND_OPTIONS="$APPEND_OPTIONS $text_install"
|
APPEND_OPTIONS="$APPEND_OPTIONS $text_install"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$console" ]
|
if [ -n "$console" ]; then
|
||||||
then
|
|
||||||
APPEND_OPTIONS="$APPEND_OPTIONS console=$console"
|
APPEND_OPTIONS="$APPEND_OPTIONS console=$console"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$tisnotify" ]
|
if [ -n "$tisnotify" ]; then
|
||||||
then
|
|
||||||
APPEND_OPTIONS="$APPEND_OPTIONS tisnotify=$tisnotify"
|
APPEND_OPTIONS="$APPEND_OPTIONS tisnotify=$tisnotify"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -160,13 +150,11 @@ APPEND_OPTIONS="$APPEND_OPTIONS inst.gpt"
|
|||||||
# Add k8s support for namespaces
|
# Add k8s support for namespaces
|
||||||
APPEND_OPTIONS="$APPEND_OPTIONS user_namespace.enable=1"
|
APPEND_OPTIONS="$APPEND_OPTIONS user_namespace.enable=1"
|
||||||
|
|
||||||
if [ -n "$security_profile" ]
|
if [ -n "$security_profile" ]; then
|
||||||
then
|
|
||||||
APPEND_OPTIONS="$APPEND_OPTIONS security_profile=$security_profile"
|
APPEND_OPTIONS="$APPEND_OPTIONS security_profile=$security_profile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$kernal_extra_args" ]
|
if [ -n "$kernal_extra_args" ]; then
|
||||||
then
|
|
||||||
APPEND_OPTIONS="$APPEND_OPTIONS $kernal_extra_args"
|
APPEND_OPTIONS="$APPEND_OPTIONS $kernal_extra_args"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -174,9 +162,8 @@ generate_config $input_file $output_file
|
|||||||
|
|
||||||
# for extended security profile UEFI boot only,
|
# for extended security profile UEFI boot only,
|
||||||
# a tboot option will be passed to target boot option menu
|
# a tboot option will be passed to target boot option menu
|
||||||
if [ "$security_profile" == "extended" -a -n "$tboot" ]
|
if [ "$security_profile" == "extended" -a -n "$tboot" ]; then
|
||||||
then
|
APPEND_OPTIONS="$APPEND_OPTIONS tboot=$tboot"
|
||||||
APPEND_OPTIONS="$APPEND_OPTIONS tboot=$tboot"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
generate_config $input_file_efi $output_file_efi
|
generate_config $input_file_efi $output_file_efi
|
||||||
|
@ -131,7 +131,7 @@ count=$((count + 1))
|
|||||||
echo $banner
|
echo $banner
|
||||||
echo "$count Delete Host Services"
|
echo "$count Delete Host Services"
|
||||||
echo $banner
|
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))
|
count=$((count + 1))
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
# skipping 'sshd' process
|
# skipping 'sshd' process
|
||||||
# sw-patch-agent restart PASSED [2740]:[17461]
|
# sw-patch-agent restart PASSED [2740]:[17461]
|
||||||
# sw-patch-controller-daemon restart PASSED [2558]:[21336]
|
# 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]
|
# syslog-ng restart PASSED [684]:[28125]
|
||||||
# vswitch does not support restart
|
# vswitch does not support restart
|
||||||
|
|
||||||
@ -65,17 +65,17 @@ NOT_RUNNING=7
|
|||||||
|
|
||||||
trap ctrl_c INT
|
trap ctrl_c INT
|
||||||
|
|
||||||
function ctrl_c(){
|
function ctrl_c {
|
||||||
echo "Exiting ..."
|
echo "Exiting ..."
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG=false
|
DEBUG=false
|
||||||
|
|
||||||
function dlog {
|
function dlog {
|
||||||
if [ ${DEBUG} == true ] ; then
|
if [ ${DEBUG} == true ] ; then
|
||||||
echo "Debug: $1"
|
echo "Debug: $1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# defaults
|
# defaults
|
||||||
@ -91,19 +91,19 @@ FILES=/etc/pmon.d/*
|
|||||||
#for file in "pmond" ${FILES}
|
#for file in "pmond" ${FILES}
|
||||||
for file in ${FILES}
|
for file in ${FILES}
|
||||||
do
|
do
|
||||||
if [ "${file}" == "pmond" ] ; then
|
if [ "${file}" == "pmond" ] ; then
|
||||||
process=${file}
|
process=${file}
|
||||||
pidfile="/var/run/pmond.pid"
|
pidfile="/var/run/pmond.pid"
|
||||||
else
|
else
|
||||||
restarts=`cat ${file} | grep ^restarts | 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' '`
|
process=`cat ${file} | grep ^process | cut -f2 -d'=' | cut -f2 -d' '`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
printf "%-30s %s - " "${process}" "${1}"
|
printf "%-30s %s - " "${process}" "${1}"
|
||||||
|
|
||||||
# Avoid testing certain processes
|
# Avoid testing certain processes
|
||||||
# ceph - pmond does not support
|
# ceph - pmond does not support
|
||||||
if [ "$process" == "ceph" -o "$process" == "vswitch" ] ; then
|
if [ "$process" == "ceph" -o "$process" == "vswitch" ] ; then
|
||||||
echo "${process} ${1} is not supported ... skipping"
|
echo "${process} ${1} is not supported ... skipping"
|
||||||
continue
|
continue
|
||||||
@ -151,67 +151,67 @@ do
|
|||||||
echo "FAILED - process not Running"
|
echo "FAILED - process not Running"
|
||||||
fi
|
fi
|
||||||
elif [ "$1" == "stop" ] ; then
|
elif [ "$1" == "stop" ] ; then
|
||||||
debounce=1
|
debounce=1
|
||||||
startuptime=1
|
startuptime=1
|
||||||
factor=1
|
factor=1
|
||||||
# Not all processes can be stopped
|
# Not all processes can be stopped
|
||||||
if [ "$process" == "pmond" -o "$process" == "sm" ] ; then
|
if [ "$process" == "pmond" -o "$process" == "sm" ] ; then
|
||||||
echo "${process} stop not supported ... skipping"
|
echo "${process} stop not supported ... skipping"
|
||||||
continue
|
continue
|
||||||
elif [ "$process" == "hbsClient" -a ! -e "/var/run/.node_locked" ] ; then
|
elif [ "$process" == "hbsClient" -a ! -e "/var/run/.node_locked" ] ; then
|
||||||
echo "${process} refusing to stop of heartbeat client on inservice host"
|
echo "${process} refusing to stop of heartbeat client on inservice host"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
pmon-stop ${process}
|
pmon-stop ${process}
|
||||||
fi
|
fi
|
||||||
elif [ "${1}" == "start" ] ; then
|
elif [ "${1}" == "start" ] ; then
|
||||||
if [ "$process" == "pmond" -o "$process" == "sm" ] ; then
|
if [ "$process" == "pmond" -o "$process" == "sm" ] ; then
|
||||||
echo "${process} stop not supported ... skipping"
|
echo "${process} stop not supported ... skipping"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
factor=1
|
factor=1
|
||||||
pmon-start ${process}
|
pmon-start ${process}
|
||||||
sleep 1
|
sleep 1
|
||||||
s=`tail -2 /var/log/pmond.log | grep "$process process is not in the stopped state"`
|
s=`tail -2 /var/log/pmond.log | grep "$process process is not in the stopped state"`
|
||||||
if [ ! -z "${s}" ] ; then
|
if [ ! -z "${s}" ] ; then
|
||||||
echo "FAILED not in stopped state"
|
echo "FAILED not in stopped state"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "${1}" == "kill" ] ; then
|
elif [ "${1}" == "kill" ] ; then
|
||||||
kill -9 ${pid1}
|
kill -9 ${pid1}
|
||||||
sleep 2
|
sleep 2
|
||||||
elif [ "${1}" == "alarm" ] ; then
|
elif [ "${1}" == "alarm" ] ; then
|
||||||
printf "action not yet supported"
|
printf "action not yet supported"
|
||||||
continue
|
continue
|
||||||
elif [ "${1}" == "critical" ] ; then
|
elif [ "${1}" == "critical" ] ; then
|
||||||
printf "action not yet supported"
|
printf "action not yet supported"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
printf "\n\nError:\nInvalid operation '${1}' specified\n"
|
printf "\n\nError:\nInvalid operation '${1}' specified\n"
|
||||||
printf "... must be restart, kill, alarm, or critical\n"
|
printf "... must be restart, kill, alarm, or critical\n"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
exit ${UNSUPPORTED_FEATURE}
|
exit ${UNSUPPORTED_FEATURE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleeptime=$((debounce + startuptime + factor))
|
sleeptime=$((debounce + startuptime + factor))
|
||||||
sleep $sleeptime
|
sleep $sleeptime
|
||||||
if [ "$1" == "stop" ] ; then
|
if [ "$1" == "stop" ] ; then
|
||||||
if [ -e "${pidfile}" ] ; then
|
if [ -e "${pidfile}" ] ; then
|
||||||
# some processes are auto restarted by systemd
|
# some processes are auto restarted by systemd
|
||||||
if [ "${process}" != "mtcClient" -a "${process}" != "syslog-ng" ] ; then
|
if [ "${process}" != "mtcClient" -a "${process}" != "syslog-ng" ] ; then
|
||||||
echo "FAILED - pidfile still present"
|
echo "FAILED - pidfile still present"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
kill -0 ${pid1} 2> /dev/null
|
kill -0 ${pid1} 2> /dev/null
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
echo "FAILED - process is still running ($pid1)"
|
echo "FAILED - process is still running ($pid1)"
|
||||||
else
|
else
|
||||||
pid2=`/usr/sbin/pidof ${process}`
|
pid2=`/usr/sbin/pidof ${process}`
|
||||||
if [ -z ${pid2} ] ; then
|
if [ -z ${pid2} ] ; then
|
||||||
echo "PASSED - process is stopped"
|
echo "PASSED - process is stopped"
|
||||||
else
|
else
|
||||||
echo "FAILED - process is running again ($pid2)"
|
echo "FAILED - process is running again ($pid2)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
# 10.10.10.42;10.10.10.43;10.10.10.44;
|
# 10.10.10.42;10.10.10.43;10.10.10.44;
|
||||||
# 10.10.10.43;
|
# 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.
|
# caller of the script to get more detail regarding the NTP servers status.
|
||||||
#
|
#
|
||||||
# This script will only be run on the controller nodes.
|
# 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
|
# is it the ip address of a controller node
|
||||||
isController ()
|
isController ()
|
||||||
{
|
{
|
||||||
host=$1
|
host=$1
|
||||||
res=$(echo $(grep $host /etc/hosts) | grep controller)
|
res=$(echo $(grep $host /etc/hosts) | grep controller)
|
||||||
|
|
||||||
if [[ "$res" != "" ]] ; then
|
if [[ "$res" != "" ]] ; then
|
||||||
logger -p info -t $0 "$host is a controller"
|
logger -p info -t $0 "$host is a controller"
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# loop through all the ntpq servers listed as IPs and get the controller's
|
# loop through all the ntpq servers listed as IPs and get the controller's
|
||||||
@ -71,14 +71,14 @@ getControllerIP ()
|
|||||||
do
|
do
|
||||||
server=$(echo $line | awk '{print $1;}')
|
server=$(echo $line | awk '{print $1;}')
|
||||||
if [[ "$line" != " "* ]] ; then
|
if [[ "$line" != " "* ]] ; then
|
||||||
# if the first char is not a space then remove it e.g +159.203.31.244
|
# 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 $server| cut -c 2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
res=$(echo $(grep $server /etc/hosts) | grep controller)
|
res=$(echo $(grep $server /etc/hosts) | grep controller)
|
||||||
if [[ "$res" != "" ]] ; then
|
if [[ "$res" != "" ]] ; then
|
||||||
echo $server
|
echo $server
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done < <(echo "$servers")
|
done < <(echo "$servers")
|
||||||
|
|
||||||
@ -98,8 +98,8 @@ bad_server_count=0
|
|||||||
|
|
||||||
# exit if there is no servers provisioned
|
# exit if there is no servers provisioned
|
||||||
if [ $server_count -eq 0 ]; then
|
if [ $server_count -eq 0 ]; then
|
||||||
logger -p info -t $0 "No NTP servers are provisioned (1)"
|
logger -p info -t $0 "No NTP servers are provisioned (1)"
|
||||||
exit $NTP_NOT_PROVISIONED
|
exit $NTP_NOT_PROVISIONED
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# query the ntp servers with ntpq
|
# query the ntp servers with ntpq
|
||||||
@ -132,14 +132,14 @@ while read line
|
|||||||
do
|
do
|
||||||
server=$(echo $line | awk '{print $1;}')
|
server=$(echo $line | awk '{print $1;}')
|
||||||
if [[ "$line" != " "* ]] ; then
|
if [[ "$line" != " "* ]] ; then
|
||||||
# if the first char is not a space then remove it e.g +159.203.31.244
|
# 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 $server| cut -c 2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add provisioned ntp server to temp file if not the controller
|
# add provisioned ntp server to temp file if not the controller
|
||||||
isController $server
|
isController $server
|
||||||
if [[ "$?" == 0 ]]; then
|
if [[ "$?" == 0 ]]; then
|
||||||
echo -n $server";" >> $ntpq_server_info
|
echo -n $server";" >> $ntpq_server_info
|
||||||
fi
|
fi
|
||||||
done < <(echo "$server_list")
|
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
|
# list all non reachable ntp servers and save in temp file
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
if [[ "$line" != "*"* ]] && [[ "$line" != "+"* ]] ;then
|
if [[ "$line" != "*"* ]] && [[ "$line" != "+"* ]] ;then
|
||||||
|
|
||||||
server=$(echo $line | awk '{print $1;}')
|
server=$(echo $line | awk '{print $1;}')
|
||||||
if [[ "$line" != " "* ]] ; then
|
if [[ "$line" != " "* ]] ; then
|
||||||
# if the first char is not a space then remove it e.g +159.203.31.244
|
# 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 $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
|
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")
|
done < <(echo "$server_list")
|
||||||
IFS=$SAVEIFS
|
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 '^*')
|
selected=$(echo "$server_list" | grep -c '^*')
|
||||||
|
|
||||||
if [ "$bad_server_count" -eq 0 ];then
|
if [ "$bad_server_count" -eq 0 ];then
|
||||||
if [ $selected -eq 0 ]; then
|
if [ $selected -eq 0 ]; then
|
||||||
logger -p info -t $0 "All external NTP servers are reachable but none is selected (4)"
|
logger -p info -t $0 "All external NTP servers are reachable but none is selected (4)"
|
||||||
exit $NTP_SOME_REACHABLE_NONE_SELECTED
|
exit $NTP_SOME_REACHABLE_NONE_SELECTED
|
||||||
else
|
else
|
||||||
logger -p info -t $0 "All external NTP servers are reachable and one is selected (0)"
|
logger -p info -t $0 "All external NTP servers are reachable and one is selected (0)"
|
||||||
exit $NTP_OK
|
exit $NTP_OK
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# it does not matter if the peer controller is the server selected, if all the
|
# 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
|
# external NTP servers are not reachable then we return NTP_NONE_REACHABLE
|
||||||
if [ "$bad_server_count" -eq "$server_count" ];then
|
if [ "$bad_server_count" -eq "$server_count" ];then
|
||||||
logger -p info -t $0 "None of the external NTP servers are reachable (2)"
|
logger -p info -t $0 "None of the external NTP servers are reachable (2)"
|
||||||
exit $NTP_NONE_REACHABLE
|
exit $NTP_NONE_REACHABLE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$bad_server_count" -lt "$server_count" ];then
|
if [ "$bad_server_count" -lt "$server_count" ];then
|
||||||
if [ $selected -eq 0 ]; then
|
if [ $selected -eq 0 ]; then
|
||||||
# this will happen if the peer controller is the selected server
|
# 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)"
|
logger -p info -t $0 "Some external NTP servers are reachable but none is selected (4)"
|
||||||
exit $NTP_SOME_REACHABLE_NONE_SELECTED
|
exit $NTP_SOME_REACHABLE_NONE_SELECTED
|
||||||
else
|
else
|
||||||
logger -p info -t $0 "Some external NTP servers are not reachable and one selected (3)"
|
logger -p info -t $0 "Some external NTP servers are not reachable and one selected (3)"
|
||||||
exit $NTP_SOME_REACHABLE
|
exit $NTP_SOME_REACHABLE
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
logger -p err -t $0 "Should not exit here"
|
logger -p err -t $0 "Should not exit here"
|
||||||
exit -1
|
exit -1
|
||||||
|
@ -10,27 +10,27 @@ source "/etc/init.d/log_functions.sh"
|
|||||||
# is it a compute subfunction on a CPE system
|
# is it a compute subfunction on a CPE system
|
||||||
isCompute ()
|
isCompute ()
|
||||||
{
|
{
|
||||||
[ -f /etc/platform/platform.conf ] || return 0
|
[ -f /etc/platform/platform.conf ] || return 0
|
||||||
res=$(grep "subfunction" /etc/platform/platform.conf | grep "controller,compute" | wc -l)
|
res=$(grep "subfunction" /etc/platform/platform.conf | grep "controller,compute" | wc -l)
|
||||||
|
|
||||||
if [ "$res" -eq 0 ] ; then
|
if [ "$res" -eq 0 ] ; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# only reload rmon if it is a CPE system
|
# only reload rmon if it is a CPE system
|
||||||
isCompute
|
isCompute
|
||||||
|
|
||||||
if [[ "$?" -eq 0 ]]; then
|
if [[ "$?" -eq 0 ]]; then
|
||||||
log "Cannot run on a non CPE system."
|
log "Cannot run on a non CPE system."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f /var/run/.compute_config_complete ]; then
|
if [ ! -f /var/run/.compute_config_complete ]; then
|
||||||
log "Cannot run prior to compute configuration complete."
|
log "Cannot run prior to compute configuration complete."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
@ -57,14 +57,14 @@ pattern=() # Stores a string indicating the present pattern
|
|||||||
|
|
||||||
|
|
||||||
function trapCalled {
|
function trapCalled {
|
||||||
echo $'\nReceived trap signal' >&2
|
echo $'\nReceived trap signal' >&2
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
trap trapCalled SIGHUP SIGINT SIGTERM
|
trap trapCalled SIGHUP SIGINT SIGTERM
|
||||||
|
|
||||||
function helpMessage {
|
function helpMessage {
|
||||||
echo "--------------------------------------------------------------------------------------"
|
echo "--------------------------------------------------------------------------------------"
|
||||||
echo "Memory Leak And Information Tracking Tool"
|
echo "Memory Leak And Information Tracking Tool"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
@ -82,7 +82,7 @@ function helpMessage {
|
|||||||
echo " /procs/<pid>/smaps"
|
echo " /procs/<pid>/smaps"
|
||||||
echo ""
|
echo ""
|
||||||
echo " Error logs can be found in /tmp/memchk_err.log"
|
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 ""
|
echo ""
|
||||||
echo "Examples:"
|
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 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 "sudo memchl --C pmond rmond hwmond ... Check PSS and RSS values of commands using default period of 3600s (1h)"
|
||||||
echo "--------------------------------------------------------------------------------------"
|
echo "--------------------------------------------------------------------------------------"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prints information on suspected leaking process
|
# Prints information on suspected leaking process
|
||||||
function memLeak {
|
function memLeak {
|
||||||
printf "\n" >&2
|
printf "\n" >&2
|
||||||
printf '%0.1s' "*"{1..150} >&2
|
printf '%0.1s' "*"{1..150} >&2
|
||||||
# Iterates over all keys in the array.
|
# Iterates over all keys in the array.
|
||||||
for proc in ${!leaking[@]}
|
for proc in ${!leaking[@]}
|
||||||
do
|
do
|
||||||
printf "\nPossible mem leak in: %s PID: %s Current RSS: %s Orig RSS: %s Current PSS: %s Orig PSS: %s\n" \
|
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
|
${leaking[proc]} $proc ${rss[proc]} ${firstR[proc]} ${lastP[proc]} ${firstP[proc]} >&2
|
||||||
done
|
done
|
||||||
printf '%0.1s' "*"{1..150} >&2
|
printf '%0.1s' "*"{1..150} >&2
|
||||||
printf "\n" >&2
|
printf "\n" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $UID -ne 0 ]; then
|
if [ $UID -ne 0 ]; then
|
||||||
echo $'\nWarning: Memchk must be run as \'root\' user to access PSS memory information'
|
echo $'\nWarning: Memchk must be run as \'root\' user to access PSS memory information'
|
||||||
echo $'Use the -h option for help\n'
|
echo $'Use the -h option for help\n'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo $'\nNo commands specified\nPlease try again and enter a command whose memory you would like to monitor'
|
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'
|
echo $'Use the -h option for help\n'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec > >(tee /tmp/NEWmemchk_out.log) 2> >(tee /tmp/NEWmemchk_err.log >&2)
|
exec > >(tee /tmp/NEWmemchk_out.log) 2> >(tee /tmp/NEWmemchk_err.log >&2)
|
||||||
@ -138,16 +138,16 @@ while [[ $# > 0 ]]; do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--C)
|
--C)
|
||||||
shift
|
shift
|
||||||
if [ "$#" -eq "0" ]; then
|
if [ "$#" -eq "0" ]; then
|
||||||
printf "Error: No commands specified.\n"
|
printf "Error: No commands specified.\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
for c in "$@"; do
|
for c in "$@"; do
|
||||||
commands+=("$1")
|
commands+=("$1")
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-h|--help)
|
-h|--help)
|
||||||
@ -164,58 +164,62 @@ done
|
|||||||
|
|
||||||
# Makes sure period has a positive value
|
# Makes sure period has a positive value
|
||||||
if [ "$period" -le "0" ]; then
|
if [ "$period" -le "0" ]; then
|
||||||
period=3600
|
period=3600
|
||||||
printf "You have entered an invalid period. Period has been set to 3600 seconds.\n"
|
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
|
# 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
|
# 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.
|
# modifying the code to display data to match your chosen period. Consider this and modify accordingly.
|
||||||
elif [ "$period" -lt "3600" ]; then
|
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
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
# Prints header for columns
|
# Prints header for columns
|
||||||
printf "\n%15s | %8s | Leak | %10s | %13s | %8s | %8s | %8s | %13s | %8s | %8s | %8s | Period: %-${#period}ss\n" \
|
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
|
"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})
|
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.
|
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.
|
# Cycles through each of the originally entered commands. This list does not change.
|
||||||
for cmd in ${commands[@]}
|
for cmd in ${commands[@]}
|
||||||
do
|
do
|
||||||
# Finds all the PIDs associated with each command (commands may have more than one instance)
|
# Finds all the PIDs associated with each command (commands may have more than one instance)
|
||||||
procs="$(pgrep $cmd)"
|
procs="$(pgrep $cmd)"
|
||||||
|
|
||||||
# The number of processes may change on each loop. Keep this in mind if expanding or reusing this script.
|
# The number of processes may change on each loop. Keep this in mind if expanding or reusing this script.
|
||||||
for pid in ${procs[@]}
|
for pid in ${procs[@]}
|
||||||
do
|
do
|
||||||
# In smaps the PSS value is located 3 lines below the line containing the process name. This works by setting
|
# 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
|
# 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.
|
# 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)
|
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
|
# obtains the RSS value of the indicated process
|
||||||
rssCurrent=$(ps -p "$pid" --no-header -o rss)
|
rssCurrent=$(ps -p "$pid" --no-header -o rss)
|
||||||
lastR[pid]="${rss[pid]}"
|
lastR[pid]="${rss[pid]}"
|
||||||
|
|
||||||
# Child processes may exist ephemerally, as a result they may be added to our list of PIDs, but no longer
|
# 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
|
# 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
|
# 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
|
# 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.
|
# 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
|
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
|
# 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
|
# 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.
|
# 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
|
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
|
# 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.
|
# or inaccurate information. It also previously allowed one to see when child processes were spawned.
|
||||||
if [ "$flag" -ne "1" ]; then
|
if [ "$flag" -ne "1" ]; then
|
||||||
firstP[pid]="$pss"
|
firstP[pid]="$pss"
|
||||||
lastP[pid]="NA"
|
lastP[pid]="NA"
|
||||||
rss[pid]="$rssCurrent"
|
rss[pid]="$rssCurrent"
|
||||||
firstR[pid]="${rss[pid]}"
|
firstR[pid]="${rss[pid]}"
|
||||||
lastR[pid]="NA"
|
lastR[pid]="NA"
|
||||||
s1[pid]=""
|
s1[pid]=""
|
||||||
s2[pid]=""
|
s2[pid]=""
|
||||||
trend[pid]=0
|
trend[pid]=0
|
||||||
@ -224,30 +228,36 @@ while true; do
|
|||||||
stable[pid]=0
|
stable[pid]=0
|
||||||
count[pid]=0
|
count[pid]=0
|
||||||
baseline[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
|
# 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
|
# 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
|
# once all of the commands' processes have been checked. A flag indicating that a possible leak has
|
||||||
# been detected is also set.
|
# been detected is also set.
|
||||||
if [ "${rss[pid]}" -lt "$rssCurrent" ]; then
|
if [ "${rss[pid]}" -lt "$rssCurrent" ]; then
|
||||||
lastR[pid]="${rss[pid]}"
|
lastR[pid]="${rss[pid]}"
|
||||||
rss[pid]="$rssCurrent"
|
rss[pid]="$rssCurrent"
|
||||||
leaking[pid]="$cmd"
|
leaking[pid]="$cmd"
|
||||||
leak[pid]="X"
|
leak[pid]="X"
|
||||||
let leakFlag=1
|
let leakFlag=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Calculates the changes in PSS and RSS usage over time. If this is the first run and there is no
|
# 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
|
# previous value with which to compare against, delta is set to 0, where delta is the change over
|
||||||
# time.
|
# time.
|
||||||
if [ "${lastP[pid]}" = "NA" ]; then changeP[$pid]=0; deltaP=0.000;
|
if [ "${lastP[pid]}" = "NA" ]; then
|
||||||
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)}');
|
changeP[$pid]=0; deltaP=0.000;
|
||||||
fi
|
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;
|
if [ "${lastR[pid]}" = "NA" ]; then
|
||||||
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)}');
|
changeR[$pid]=0; deltaR=0.000;
|
||||||
fi
|
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
|
# 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
|
# 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.
|
# 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.
|
# 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.
|
# 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 count[pid]+=1
|
||||||
let baseline[pid]+="$rssCurrent"
|
let baseline[pid]+="$rssCurrent"
|
||||||
avg=$(awk -v b="${baseline[pid]}" -v c="${count[pid]}" 'BEGIN {printf "%.0f", (b/c); exit(0)}')
|
avg=$(awk -v b="${baseline[pid]}" -v c="${count[pid]}" 'BEGIN {printf "%.0f", (b/c); exit(0)}')
|
||||||
if [ "${trend[pid]}" -ge "3" ]; then
|
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 [ "${rss[pid]}" -gt "$avg" ] && ([ "${s1[pid]}" = "increasing" ] || ([ "${s1[pid]}" != "decreasing" ] && [ "${s2[pid]}" != "decreasing" ]) && [ "${stable[pid]}" -ne "3" ]); then
|
||||||
if [ "${s1[pid]}" != "increasing" ]; then
|
if [ "${s1[pid]}" != "increasing" ]; then
|
||||||
s2[pid]="${s1[pid]}"
|
s2[pid]="${s1[pid]}"
|
||||||
s1[pid]="increasing"
|
s1[pid]="increasing"
|
||||||
fi
|
fi
|
||||||
elif [ "${rss[pid]}" -eq "$avg" ]; then
|
elif [ "${rss[pid]}" -eq "$avg" ]; then
|
||||||
if [ "${s1[pid]}" != "stable" ]; then
|
if [ "${s1[pid]}" != "stable" ]; then
|
||||||
stable[pid]=0
|
stable[pid]=0
|
||||||
s2[pid]="${s1[pid]}"
|
s2[pid]="${s1[pid]}"
|
||||||
s1[pid]="stable"
|
s1[pid]="stable"
|
||||||
fi
|
fi
|
||||||
let stable[pid]+=1
|
let stable[pid]+=1
|
||||||
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
|
elif [ "${rss[pid]}" -lt "$avg" ] && ([ "${s1[pid]}" = "decreasing" ] || ([ "${s1[pid]}" != "increasing" ] && [ "${s2[pid]}" != "increasing" ]) && [ "${stable[pid]}" -ne "3" ]); then
|
||||||
if [ "${s1[pid]}" != "decreasing" ]; then
|
if [ "${s1[pid]}" != "decreasing" ]; then
|
||||||
s2[pid]="${s1[pid]}"
|
s2[pid]="${s1[pid]}"
|
||||||
s1[pid]="decreasing"
|
s1[pid]="decreasing"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
s1[pid]=""
|
s1[pid]=""
|
||||||
s2[pid]=""
|
s2[pid]=""
|
||||||
trend[pid]=0
|
trend[pid]=0
|
||||||
increasing[pid]=0
|
increasing[pid]=0
|
||||||
decreasing[pid]=0
|
decreasing[pid]=0
|
||||||
stable[pid]=0
|
stable[pid]=0
|
||||||
fi
|
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,
|
# 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
|
# 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.
|
# 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 [ "${count[pid]}" -gt "0" ]; then
|
||||||
if [ "${rss[pid]}" -gt "$avg" ]; then
|
if [ "${rss[pid]}" -gt "$avg" ]; then
|
||||||
let trend[pid]+=1
|
let trend[pid]+=1
|
||||||
let increasing[pid]+=1
|
let increasing[pid]+=1
|
||||||
s1[pid]="increasing"
|
s1[pid]="increasing"
|
||||||
elif [ "${rss[pid]}" -eq "$avg" ]; then
|
elif [ "${rss[pid]}" -eq "$avg" ]; then
|
||||||
let trend[pid]+=1
|
let trend[pid]+=1
|
||||||
let stable[pid]+=1
|
let stable[pid]+=1
|
||||||
s1[pid]="stable"
|
s1[pid]="stable"
|
||||||
elif [ "${rss[pid]}" -lt "$avg" ]; then
|
elif [ "${rss[pid]}" -lt "$avg" ]; then
|
||||||
let trend[pid]+=1
|
let trend[pid]+=1
|
||||||
let decreasing[pid]+=1
|
let decreasing[pid]+=1
|
||||||
s1[pid]="decreasing"
|
s1[pid]="decreasing"
|
||||||
fi
|
fi
|
||||||
if [ "${increasing[pid]}" -gt "0" ] && [ "${decreasing[pid]}" -gt "0" ]; then
|
if [ "${increasing[pid]}" -gt "0" ] && [ "${decreasing[pid]}" -gt "0" ]; then
|
||||||
increasing[pid]=0
|
increasing[pid]=0
|
||||||
decreasing[pid]=0
|
decreasing[pid]=0
|
||||||
stable[pid]=0
|
stable[pid]=0
|
||||||
trend[pid]=0
|
trend[pid]=0
|
||||||
fi
|
fi
|
||||||
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
|
if [ "${trend[pid]}" -ge "3" ]; then
|
||||||
|
pattern[pid]="${s1[pid]}";
|
||||||
|
else
|
||||||
|
pattern[pid]="none";
|
||||||
printf "\n%15s | %8s | %2s | %10s | %8s kB/h | %8s | %8s | %8s | %8s kB/h | %8s | %8s | %8s |" \
|
fi # Sets the trend variable for printing if a trend exists
|
||||||
$cmd $pid "${leak[pid]}" "${pattern[pid]}" $deltaR ${rss[pid]} ${firstR[pid]} ${lastR[pid]} $deltaP $pss ${firstP[pid]} ${lastP[pid]} >&1
|
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"
|
lastP[pid]="$pss"
|
||||||
leak[pid]="" # Resets the indicator in the 'Leak' column
|
leak[pid]="" # Resets the indicator in the 'Leak' column
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$leakFlag" -eq "1" ]; then memLeak leaking[@]; fi # Calls the mem leak function if flag is set
|
if [ "$leakFlag" -eq "1" ]; then
|
||||||
unset leaking[@] # Clear the array holding PIDs of processes with potential leaks
|
memLeak leaking[@];
|
||||||
let leakFlag=0
|
fi # Calls the mem leak function if flag is set
|
||||||
let hours+=1 # Hour count[pid]er used in calculating delta
|
unset leaking[@] # Clear the array holding PIDs of processes with potential leaks
|
||||||
let flag=1 # Flag indicating that first run has completed so we no longer have to set values of 'NA'
|
let leakFlag=0
|
||||||
echo $'\n'
|
let hours+=1 # Hour count[pid]er used in calculating delta
|
||||||
sleep "$period"
|
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
|
done
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: hwclock
|
# Provides: hwclock
|
||||||
# Required-Start:
|
# Required-Start:
|
||||||
# Required-Stop: $local_fs
|
# Required-Stop: $local_fs
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 6
|
# Default-Stop: 0 6
|
||||||
@ -29,64 +29,56 @@
|
|||||||
|
|
||||||
[ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime"
|
[ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime"
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
if [ "$VERBOSE" != no ]
|
if [ "$VERBOSE" != no ] ;then
|
||||||
then
|
echo "System time was `date`."
|
||||||
echo "System time was `date`."
|
echo "Setting the System Clock using the Hardware Clock as reference..."
|
||||||
echo "Setting the System Clock using the Hardware Clock as reference..."
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$HWCLOCKACCESS" != no ]
|
if [ "$HWCLOCKACCESS" != no ] ;then
|
||||||
then
|
if [ -z "$TZ" ] ;then
|
||||||
if [ -z "$TZ" ]
|
hwclock $tz --hctosys
|
||||||
then
|
else
|
||||||
hwclock $tz --hctosys
|
TZ="$TZ" hwclock $tz --hctosys
|
||||||
else
|
fi
|
||||||
TZ="$TZ" hwclock $tz --hctosys
|
fi
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$VERBOSE" != no ]
|
if [ "$VERBOSE" != no ]; then
|
||||||
then
|
echo "System Clock set. System local time is now `date`."
|
||||||
echo "System Clock set. System local time is now `date`."
|
fi
|
||||||
fi
|
;;
|
||||||
;;
|
stop|restart|reload|force-reload)
|
||||||
stop|restart|reload|force-reload)
|
#
|
||||||
#
|
# Updates the Hardware Clock with the System Clock time.
|
||||||
# Updates the Hardware Clock with the System Clock time.
|
# This will *override* any changes made to the Hardware Clock.
|
||||||
# This will *override* any changes made to the Hardware Clock.
|
#
|
||||||
#
|
# WARNING: If you disable this, any changes to the system
|
||||||
# WARNING: If you disable this, any changes to the system
|
# clock will not be carried across reboots.
|
||||||
# clock will not be carried across reboots.
|
#
|
||||||
#
|
if [ "$VERBOSE" != no ]; then
|
||||||
if [ "$VERBOSE" != no ]
|
echo "Saving the System Clock time to the Hardware Clock..."
|
||||||
then
|
fi
|
||||||
echo "Saving the System Clock time to the Hardware Clock..."
|
if [ "$HWCLOCKACCESS" != no ]; then
|
||||||
fi
|
hwclock $tz --systohc
|
||||||
if [ "$HWCLOCKACCESS" != no ]
|
fi
|
||||||
then
|
if [ "$VERBOSE" != no ]; then
|
||||||
hwclock $tz --systohc
|
echo "Hardware Clock updated to `date`."
|
||||||
fi
|
fi
|
||||||
if [ "$VERBOSE" != no ]
|
exit 0
|
||||||
then
|
;;
|
||||||
echo "Hardware Clock updated to `date`."
|
show)
|
||||||
fi
|
if [ "$HWCLOCKACCESS" != no ]; then
|
||||||
exit 0
|
hwclock $tz --show
|
||||||
;;
|
fi
|
||||||
show)
|
;;
|
||||||
if [ "$HWCLOCKACCESS" != no ]
|
status)
|
||||||
then
|
stiatus hwclock
|
||||||
hwclock $tz --show
|
exit $?
|
||||||
fi
|
;;
|
||||||
;;
|
*)
|
||||||
status)
|
echo "Usage: hwclock.sh {start|stop|status|show|reload|restart}" >&2
|
||||||
stiatus hwclock
|
echo " start sets kernel (system) clock from hardware (RTC) clock" >&2
|
||||||
exit $?
|
echo " stop and reload set hardware (RTC) clock from kernel (system) clock" >&2
|
||||||
;;
|
exit 1
|
||||||
*)
|
;;
|
||||||
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
|
esac
|
||||||
|
@ -13,61 +13,61 @@ primary_resource="sysinv-api"
|
|||||||
proc="Platform RA Soak:"
|
proc="Platform RA Soak:"
|
||||||
count=0
|
count=0
|
||||||
delay_list="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
|
delay_list="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
|
||||||
|
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
|
||||||
logger "$proc Stopping Platform Resource Agents ----------"
|
logger "$proc Stopping Platform Resource Agents ----------"
|
||||||
crm resource stop $primary_resource
|
crm resource stop $primary_resource
|
||||||
for delay in $delay_list
|
for delay in $delay_list
|
||||||
do
|
do
|
||||||
sleep 1
|
sleep 1
|
||||||
echo -n "."
|
echo -n "."
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
status=`crm resource status`
|
status=`crm resource status`
|
||||||
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
|
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
|
||||||
do
|
do
|
||||||
status_tmp=`echo "$status" | grep $service | cut -f2 -d')'`
|
status_tmp=`echo "$status" | grep $service | cut -f2 -d')'`
|
||||||
if [ "$status_tmp" != " Stopped " ] ; then
|
if [ "$status_tmp" != " Stopped " ] ; then
|
||||||
echo "$proc ($count) Stop $service Failed <$status_tmp>"
|
echo "$proc ($count) Stop $service Failed <$status_tmp>"
|
||||||
sleep 5
|
sleep 5
|
||||||
crm resource status
|
crm resource status
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "$proc ($count) Stop O.K. for $service"
|
echo "$proc ($count) Stop O.K. for $service"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
logger "$proc Stop O.K. -------------------------------"
|
logger "$proc Stop O.K. -------------------------------"
|
||||||
|
|
||||||
logger "$proc Starting Platform Resource Agents ----------"
|
logger "$proc Starting Platform Resource Agents ----------"
|
||||||
crm resource start $primary_resource
|
crm resource start $primary_resource
|
||||||
for delay in $delay_list
|
for delay in $delay_list
|
||||||
do
|
do
|
||||||
sleep 1
|
sleep 1
|
||||||
echo -n "."
|
echo -n "."
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
status=`crm resource status`
|
status=`crm resource status`
|
||||||
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
|
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
|
||||||
do
|
do
|
||||||
status_tmp=`echo "$status" | grep $service | cut -f2 -d')'`
|
status_tmp=`echo "$status" | grep $service | cut -f2 -d')'`
|
||||||
if [ "$status_tmp" != " Started " ] ; then
|
if [ "$status_tmp" != " Started " ] ; then
|
||||||
echo "$proc ($count) Start $service Failed <$status_tmp>"
|
echo "$proc ($count) Start $service Failed <$status_tmp>"
|
||||||
sleep 5
|
sleep 5
|
||||||
crm resource status
|
crm resource status
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "$proc ($count) Start O.K. for $service"
|
echo "$proc ($count) Start O.K. for $service"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
logger "$proc Start O.K. ------------------------------"
|
logger "$proc Start O.K. ------------------------------"
|
||||||
|
|
||||||
count=`expr $count + 1`
|
count=`expr $count + 1`
|
||||||
mtc=`cat /var/run/mtcAgent.pid`
|
mtc=`cat /var/run/mtcAgent.pid`
|
||||||
hbs=`cat /var/run/hbsAgent.pid`
|
hbs=`cat /var/run/hbsAgent.pid`
|
||||||
echo "$mtc:`pidof mtcAgent` <:> $hbs:`pidof hbsAgent`"
|
echo "$mtc:`pidof mtcAgent` <:> $hbs:`pidof hbsAgent`"
|
||||||
done
|
done
|
||||||
|
@ -13,27 +13,27 @@ primary_resource="svr_vip"
|
|||||||
proc="Openstack Swact Soak:"
|
proc="Openstack Swact Soak:"
|
||||||
count=0
|
count=0
|
||||||
delay_list="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
|
delay_list="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
|
||||||
|
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
|
||||||
logger "$proc Swacting to Controller 1 ----------"
|
logger "$proc Swacting to Controller 1 ----------"
|
||||||
crm resource move $primary_resource controller-1
|
crm resource move $primary_resource controller-1
|
||||||
for delay in $delay_list
|
for delay in $delay_list
|
||||||
do
|
do
|
||||||
sleep 10
|
sleep 10
|
||||||
echo -n "."
|
echo -n "."
|
||||||
crm status
|
crm status
|
||||||
done
|
done
|
||||||
|
|
||||||
logger "$proc Swacting to Controller 0 ----------"
|
logger "$proc Swacting to Controller 0 ----------"
|
||||||
crm resource move $primary_resource controller-0
|
crm resource move $primary_resource controller-0
|
||||||
for delay in $delay_list
|
for delay in $delay_list
|
||||||
do
|
do
|
||||||
sleep 10
|
sleep 10
|
||||||
echo -n "."
|
echo -n "."
|
||||||
crm status
|
crm status
|
||||||
done
|
done
|
||||||
|
|
||||||
done
|
done
|
||||||
|
@ -20,7 +20,7 @@ GENERIC_ERROR=1
|
|||||||
|
|
||||||
NOVA_GOENABLED_TAG=${NOVA_GOENABLED_TAG:-"NOVA_GOENABLED"}
|
NOVA_GOENABLED_TAG=${NOVA_GOENABLED_TAG:-"NOVA_GOENABLED"}
|
||||||
|
|
||||||
function log
|
log()
|
||||||
{
|
{
|
||||||
logger -p local1.info -t ${NOVA_GOENABLED_TAG} $@
|
logger -p local1.info -t ${NOVA_GOENABLED_TAG} $@
|
||||||
}
|
}
|
||||||
@ -32,22 +32,18 @@ NOVA_ADVANCE_ENABLED="/var/run/.nova_timer_advance_enabled"
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
if [ -e ${VOLATILE_COMPUTE_CONFIG_COMPLETE} ] && [ ! -e ${VOLATILE_DISABLE_COMPUTE_SERVICES} ]
|
if [ -e ${VOLATILE_COMPUTE_CONFIG_COMPLETE} ] && [ ! -e ${VOLATILE_DISABLE_COMPUTE_SERVICES} ]; then
|
||||||
then
|
|
||||||
log "Start"
|
log "Start"
|
||||||
|
|
||||||
if [ -e ${NOVA_INIT_FAILED} ]
|
if [ -e ${NOVA_INIT_FAILED} ]; then
|
||||||
then
|
|
||||||
log "Nova-Init check FAILED"
|
log "Nova-Init check FAILED"
|
||||||
exit ${GENERIC_ERROR}
|
exit ${GENERIC_ERROR}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Nova-Init check PASSED"
|
log "Nova-Init check PASSED"
|
||||||
|
|
||||||
while :
|
while [ true ]; do
|
||||||
do
|
if [ -e ${NOVA_ADVANCE_ENABLED} ]; then
|
||||||
if [ -e ${NOVA_ADVANCE_ENABLED} ]
|
|
||||||
then
|
|
||||||
log "Nova setup timer advance PASSED"
|
log "Nova setup timer advance PASSED"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@ -55,10 +51,8 @@ case "$1" in
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
while :
|
while [ true ]; do
|
||||||
do
|
if [ -e ${NOVA_COMPUTE_ENABLED} ]; then
|
||||||
if [ -e ${NOVA_COMPUTE_ENABLED} ]
|
|
||||||
then
|
|
||||||
log "Nova-Compute service enabled PASSED"
|
log "Nova-Compute service enabled PASSED"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -9,7 +9,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
|||||||
|
|
||||||
NAME=$(basename $0)
|
NAME=$(basename $0)
|
||||||
|
|
||||||
function LOG()
|
LOG()
|
||||||
{
|
{
|
||||||
logger "$NAME: $*"
|
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
|
# - 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 vmx is enabled on QEMU, it can also support nested virtualization
|
||||||
|
|
||||||
if [ "${host_type}" = "physical" ] && [ "${hardware_virt_supported}" == "false" ]
|
if [ "${host_type}" = "physical" ] && [ "${hardware_virt_supported}" == "false" ]; then
|
||||||
then
|
|
||||||
LOG "Virtualization is not supported: ${OPTS}. Failing goenabled check."
|
LOG "Virtualization is not supported: ${OPTS}. Failing goenabled check."
|
||||||
LOG "Failure reasons:"$'\n'"${REASONS}"
|
LOG "Failure reasons:"$'\n'"${REASONS}"
|
||||||
exit 1
|
exit 1
|
||||||
|
5
tox.ini
5
tox.ini
@ -14,6 +14,9 @@ deps = -r{toxinidir}/test-requirements.txt
|
|||||||
|
|
||||||
[testenv:linters]
|
[testenv:linters]
|
||||||
whitelist_externals = bash
|
whitelist_externals = bash
|
||||||
|
#bashate ignore errors
|
||||||
|
#E010: do not on the same line as for
|
||||||
|
#E006 Line too long
|
||||||
commands =
|
commands =
|
||||||
bash -c "find {toxinidir} \
|
bash -c "find {toxinidir} \
|
||||||
-not \( -type d -name .?\* -prune \) \
|
-not \( -type d -name .?\* -prune \) \
|
||||||
@ -21,7 +24,7 @@ commands =
|
|||||||
-not -name \*~ \
|
-not -name \*~ \
|
||||||
-not -name \*.md \
|
-not -name \*.md \
|
||||||
-name \*.sh \
|
-name \*.sh \
|
||||||
-print0 | xargs -0 bashate -v"
|
-print0 | xargs -0 bashate -v -i E010,E006"
|
||||||
bash -c "find {toxinidir} \
|
bash -c "find {toxinidir} \
|
||||||
\( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \
|
\( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \
|
||||||
-o \( -name .tox -prune \) \
|
-o \( -name .tox -prune \) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user