upstream/openstack/python-keystone/centos/files/keystone-all
Tee Ngo e0e3b52400 AIO Reduce number of workers
TIS_WORKERS_FACTOR for keystone service is reduced to 1 for all AIO
variants.

Tests conducted:
- Bulk VM launch/delete via heat stack create/delete - duplex (20 VMs) &
  simplex (10 VMs)
- Swact, failover, parallel live migration - duplex
- Lock/unlock with max VMs, DOR - both duplex & simplex
- Sanity, nightly sanity - both duplex & simplex
- Full nova regression - duplex
- Bulk VM launch/delete stress test - duplex (60 VMs)
- Platform CPU adjustments via system host-cpu-modify
- Ceilometer message queues verification
- Standard system installation

Change-Id: Ia455f1492ed3950ec937ad6d3a2e08b2364d9665
Signed-off-by: Jack Ding <jack.ding@windriver.com>
2018-06-28 21:56:19 -04:00

157 lines
4.1 KiB
Bash

#!/bin/sh
# Copyright (c) 2013-2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
### BEGIN INIT INFO
# Provides: OpenStack Keystone-wsgi
# Required-Start: networking
# Required-Stop: networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenStack Keystone
# Description: Openstack Identitiy service running on WSGI compatable gunicorn web server
#
### END INIT INFO
RETVAL=0
#public 5000
DESC_PUBLIC="openstack-keystone"
PIDFILE_PUBLIC="/var/run/$DESC_PUBLIC.pid"
PYTHON=`which python`
source /etc/keystone/keystone-extra.conf
source /etc/platform/platform.conf
if [ -n ${@:2:1} ] ; then
if [ ${@:2:1}="--public-bind-addr" ] ; then
PUBLIC_BIND_ADDR_CMD=${@:3:1}
fi
fi
###
EXEC="/usr/bin/gunicorn"
WORKER="eventlet"
# Increased timeout to facilitate large image uploads
TIMEOUT="200"
# Calculate the no of workers based on the number of workers retrieved by
# Platform Eng which is retreived from the keystone-extra.conf
if [ "$system_type" == "All-in-one" ]; then
TIS_WORKERS_FACTOR=1
else
TIS_WORKERS_FACTOR=1.5
fi
TIS_WORKERS=$(echo "${TIS_WORKERS_FACTOR}*${TIS_PUBLIC_WORKERS}"|bc )
TIS_WORKERS=${TIS_WORKERS%.*}
#--max-requests , --max-requests-jitter Configuration
#--max-requests = The max number of requests a worker will process before restarting
#--max-requests-jitter = The maximum jitter to add to the max_requests setting.
MAX_REQUESTS=100000
MAX_REQ_JITTER_CAP_FACTOR=0.5
MAX_REQ_JITTER_PUBLIC=$(echo "${TIS_WORKERS}*${MAX_REQ_JITTER_CAP_FACTOR}+1"|bc)
MAX_REQ_JITTER_PUBLIC=${MAX_REQ_JITTER_PUBLIC%.*}
start()
{
# Got proper no of workers . Starting gunicorn now
echo -e "Initialising keystone service using gunicorn .. \n"
if [ -z "$PUBLIC_BIND_ADDR" ]; then
echo "Keystone floating ip not found . Cannot start services. Exiting .."
exit 1
fi
BIND_PUBLIC=$PUBLIC_BIND_ADDR:5000
if [ -e $PIDFILE_PUBLIC ]; then
PIDDIR=/proc/$(cat $PIDFILE_PUBLIC)
if [ -d ${PIDDIR} ]; then
echo "$DESC_PUBLIC already running."
exit 1
else
echo "Removing stale PID file $PIDFILE_PUBLIC"
rm -f $PIDFILE_PUBLIC
fi
fi
echo -e "Starting $DESC_PUBLIC...\n";
echo -e "Worker is ${WORKER} --workers ${TIS_WORKERS} --timeout ${TIMEOUT} --max_requests ${MAX_REQUESTS} --max_request_jitter public ${MAX_REQ_JITTER_PUBLIC}\n" ;
echo -e "Starting keystone process at port 5000 \n" ;
start-stop-daemon --start --quiet --background --pidfile ${PIDFILE_PUBLIC} \
--make-pidfile --exec ${PYTHON} -- ${EXEC} --bind ${BIND_PUBLIC} \
--worker-class ${WORKER} --workers ${TIS_WORKERS} --timeout ${TIMEOUT} \
--max-requests ${MAX_REQUESTS} --max-requests-jitter ${MAX_REQ_JITTER_PUBLIC} \
--log-syslog \
--pythonpath '/usr/share/keystone' public:application --name keystone-public
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo -e "Keystone started at port 5000... \n"
else
echo -e "Failed to start Keystone .. \n"
fi
}
stop()
{
if [ -e $PIDFILE_PUBLIC ]; then
start-stop-daemon --stop --quiet --pidfile $PIDFILE_PUBLIC
RETVAL_PUBLIC=$?
if [ $RETVAL_PUBLIC -eq 0 ]; then
echo "Stopped $DESC_PUBLIC."
else
echo "Stopping failed - $PIDFILE_PUBLIC"
fi
rm -f $PIDFILE_PUBLIC
else
echo "Already stopped - $PIDFILE_PUBLIC"
fi
}
status()
{
pid_public=`cat $PIDFILE_PUBLIC 2>/dev/null`
if [ -n "$pid_public" ]; then
echo -e "\033[32m $DESC_PUBLIC is running..\033[0m"
else
echo -e "\033[31m $DESC_PUBLIC is not running..\033[0m"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload|reload)
stop
start
;;
status)
status
;;
*)
#echo "Usage: $0 {start|stop|force-reload|restart|reload|status} OR {/usr/bin/keystone-all start --public-bind-addr xxx.xxx.xxx}"
start
#RETVAL=1
;;
esac
exit $RETVAL