Remove all nova and libvirt files from mtce-common

The nova and libvirt service files no longer need to be installed.
This commit needs to merge along with the code that removes
the nova RPMS from the product, and removes the nova setup
from puppet.

Story: 2004764
Task: 30038
Depends-On: Ifa0171b06e23fd77d373983d644df3f56ae4e2de
Change-Id: I03ae4a804fbc03d51fd9e2cde59e25760fb53d3d
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
This commit is contained in:
Al Bailey 2019-03-15 10:08:08 -05:00
parent 6ccf0b68c0
commit 926b3d5086
15 changed files with 4 additions and 688 deletions

View File

@ -192,7 +192,7 @@ typedef enum {
/** Local event control structure for REST API services
*
* Nova, Neutron, Keystone, Barbican and Inventory
* Keystone, Barbican and Inventory
*
*/
struct libEvent

View File

@ -53,7 +53,7 @@ typedef struct
string tokenid ; /**< The long encrypted toke.n */
string issued ; /**< The "issued_at": "<date-time>". */
string expiry ; /**< The "expires": "<date-time>". */
string adminURL; /**< path to the nova server. */
string adminURL; /**< path to the token server. */
} jsonUtil_auth_type ;
#define MAX_JSON_SECRET_CONTENTS_NUM 7
@ -113,7 +113,7 @@ int jsonUtil_get_key_val_int ( char * json_str_ptr,
string key,
int & value );
/** Submit a request to get an authorization token and nova URL */
/** Submit a request to get an authorization token */
int jsonApi_auth_request ( string & hostname, string & payload );
/** Parse through the authorization request's response json string

View File

@ -592,19 +592,9 @@ int tokenUtil_handler ( libEvent & event )
{
/* Response: {"services":
[
{"id": "49fc93c32d734c78a9d9f975c22f1703", "type": "network", "name": "neutron", "description": "Neutron Networking Service"},
{"id": "0900a982ff114e7ba62c317443b43362", "type": "metering", "name": "ceilometer", "description": "Openstack Metering Service"},
{"id": "97940d057bec47cc989cc190b4293aad", "type": "ec2", "name": "nova_ec2", "description": "EC2 Service"},
{"id": "7ce51d481d024b1f8b80bb1127b80752", "type": "volumev2", "name": "cinderv2", "description": "Cinder Service v2"},
{"id": "3ed8ae6ccf85445ebdf2e93bbce9f5fb", "type": "computev3", "name": "novav3", "description": "Openstack Compute Service v3"},
{"id": "564bf663693c49cf9fee24e2fdbdba3a", "type": "identity", "name": "keystone", "description": "OpenStack Identity Service"},
{"id": "7e0cadd9db444342b7fddb0005c4ce5f", "type": "platform", "name": "sysinv", "description": "SysInv Service"},
{"id": "be7afccda91c4ba19ac2e53f613c6b63", "type": "volume", "name": "cinder", "description": "Cinder Service"},
{"id": "edf60a37f4f84b9baba215d8346b814f", "type": "image", "name": "glance", "description": "Openstack Image Service"},
{"id": "0673921c7b094178989455a5b157fb60", "type": "patching", "name": "patching", "description": "Patching Service"},
{"id": "d7621026166f43c0a1c74e0e9784cce6", "type": "compute", "name": "nova", "description": "Openstack Compute Service"},
{"id": "aef585311e3144e0b1267ea25dc40b70", "type": "orchestration", "name": "heat", "description": "Openstack Orchestration Service"},
{"id": "0a67bc174fa0469e9b837daf23d83aaf", "type": "cloudformation", "name": "heat-cfn", "description": "Openstack Cloudformation Service"}
]} */
bool found = false ;

View File

@ -1,3 +1,3 @@
SRC_DIR="$PKG_BASE/src"
COPY_LIST="$SRC_DIR/*"
TIS_PATCH_VER=6
TIS_PATCH_VER=7

View File

@ -1,6 +1,5 @@
%define local_etc_pmond %{_sysconfdir}/pmon.d
%define local_etc_goenabledd %{_sysconfdir}/goenabled.d
%define local_etc_nova %{_sysconfdir}/nova
%define debug_package %{nil}
@ -35,23 +34,14 @@ make install buildroot=%{buildroot} _sysconfdir=%{_sysconfdir} _unitdir=%{_unitd
%post
/bin/systemctl enable goenabled-worker.service
/bin/systemctl enable e_nova-init.service
/bin/systemctl enable qemu_clean.service
%files
%defattr(-,root,root,-)
%{_sysconfdir}/init.d/goenabledWorker
%{_sysconfdir}/init.d/e_nova-init
%{_sysconfdir}/init.d/nova-cleanup
%{_sysconfdir}/init.d/nova-startup
%{local_etc_nova}/nova-cleanup.conf
%{local_etc_nova}/nova-compute.conf
%{local_etc_pmond}/libvirtd.conf
%{local_etc_goenabledd}/nova-goenabled.sh
%{local_etc_goenabledd}/virt-support-goenabled.sh
%{_unitdir}/goenabled-worker.service
%{_unitdir}/e_nova-init.service
%license %{_datarootdir}/licenses/mtce-compute-1.0/LICENSE

View File

@ -1,23 +1,13 @@
SOURCE1 = goenabled
SOURCE2 = e_nova-init
SOURCE3 = nova-cleanup
SOURCE4 = nova-startup
SOURCE5 = LICENSE
SOURCE11 = nova-cleanup.conf
SOURCE12 = nova-compute.conf
SOURCE14 = libvirtd.conf
SOURCE21 = nova-goenabled.sh
SOURCE22 = virt-support-goenabled.sh
SOURCE31 = goenabled-worker.service
SOURCE32 = e_nova-init.service
local_etc_pmond = $(_sysconfdir)/pmon.d
local_etc_goenabledd = $(_sysconfdir)/goenabled.d
local_etc_nova = $(_sysconfdir)/nova
.PHONY: default
@ -25,22 +15,13 @@ install:
# nfv-plugins
# # Compute-Only Init Scripts (source group x)
install -m 755 -p -D scripts/$(SOURCE1) $(buildroot)/$(_sysconfdir)/init.d/goenabledWorker
install -m 755 -p -D scripts/$(SOURCE2) $(buildroot)/$(_sysconfdir)/init.d/e_nova-init
install -m 755 -p -D scripts/$(SOURCE3) $(buildroot)/$(_sysconfdir)/init.d/nova-cleanup
install -m 755 -p -D scripts/$(SOURCE4) $(buildroot)/$(_sysconfdir)/init.d/nova-startup
# # Compute-Only Process Monitor Config files (source group 1x)
install -m 755 -d $(buildroot)/$(local_etc_pmond)
install -m 755 -d $(buildroot)/$(local_etc_nova)
install -m 644 -p -D scripts/$(SOURCE11) $(buildroot)/$(local_etc_nova)/nova-cleanup.conf
install -m 644 -p -D scripts/$(SOURCE12) $(buildroot)/$(local_etc_nova)/nova-compute.conf
install -m 644 -p -D scripts/$(SOURCE14) $(buildroot)/$(local_etc_pmond)/libvirtd.conf
# # Compute-Only Go Enabled Test (source group 2x)
install -m 755 -d $(buildroot)/$(local_etc_goenabledd)
install -m 755 -p -D scripts/$(SOURCE21) $(buildroot)/$(local_etc_goenabledd)/nova-goenabled.sh
install -m 755 -p -D scripts/$(SOURCE22) $(buildroot)/$(local_etc_goenabledd)/virt-support-goenabled.sh
# Install to systemd (source group 3x)
install -m 644 -p -D scripts/$(SOURCE31) $(buildroot)/$(_unitdir)/goenabled-worker.service
install -m 644 -p -D scripts/$(SOURCE32) $(buildroot)/$(_unitdir)/e_nova-init.service
# for license
install -m 755 -d $(buildroot)/$(_datarootdir)/licenses/mtce-compute-1.0
install -p -D -m 600 $(SOURCE5) $(buildroot)/$(_datarootdir)/licenses/mtce-compute-1.0/LICENSE

View File

@ -1,159 +0,0 @@
#! /bin/bash
#
# Copyright (c) 2015-2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
### BEGIN INIT INFO
# Provides: nova-init
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Cleanup pmon.d nova linkages
### END INIT INFO
# Platform paths and flags
. /usr/bin/tsconfig
# Linux Standard Base (LSB) Error Codes
SUCCESS=0
GENERIC_ERROR=1
INVALID_ARGS=2
NOVA_INIT_TAG=${NOVA_INIT_TAG:-"NOVA_INIT"}
function log
{
logger -p local1.info -t ${NOVA_INIT_TAG} $@
}
NOVA_RUN="/var/run/nova"
NOVA_INIT_FAILED="${NOVA_RUN}/.nova_init_failed"
NOVA_CLEANUP_DONE_FILE="${NOVA_RUN}/.nova_cleanup_done"
NOVA_COMPUTE_ENABLED="${NOVA_RUN}/.nova_compute_enabled"
NOVA_CLEANUP_PID_FILE="${NOVA_RUN}/nova-cleanup.pid"
NOVA_COMPUTE_PMOND_TARGET="/etc/nova/nova-compute.conf"
NOVA_COMPUTE_PMOND_SYMLINK="/etc/pmon.d/nova-compute.conf"
NOVA_CLEANUP_PMOND_TARGET="/etc/nova/nova-cleanup.conf"
NOVA_CLEANUP_PMOND_SYMLINK="/etc/pmon.d/nova-cleanup.conf"
case "$1" in
start)
log "Start"
mkdir -p ${NOVA_RUN}
chown nova:root ${NOVA_RUN}
# Assume we failed, and clear when we make it to nova-cleanup phase.
touch ${NOVA_INIT_FAILED}
if [ -f ${NOVA_COMPUTE_ENABLED} ]
then
rm ${NOVA_COMPUTE_ENABLED}
fi
if [ -f ${NOVA_CLEANUP_PID_FILE} ]
then
rm ${NOVA_CLEANUP_PID_FILE}
fi
if [ -f ${NOVA_CLEANUP_DONE_FILE} ]
then
rm ${NOVA_CLEANUP_DONE_FILE}
fi
if [ -e ${NOVA_COMPUTE_PMOND_SYMLINK} ]
then
rm ${NOVA_COMPUTE_PMOND_SYMLINK}
fi
# Do not continue if the host has not been configured. We don't
# want to run nova-compute before its config file has been updated.
if [ ! -f ${INITIAL_WORKER_CONFIG_COMPLETE} ]
then
log "Initial worker configuration is not complete"
exit ${GENERIC_ERROR}
fi
# Do not continue if the worker services are disabled.
if [ -f ${VOLATILE_DISABLE_WORKER_SERVICES} ]
then
log "Worker services are disabled, nothing to do"
rm ${NOVA_INIT_FAILED}
exit ${SUCCESS}
fi
if ! [ -e ${NOVA_CLEANUP_PMOND_SYMLINK} ]
then
ln -s ${NOVA_CLEANUP_PMOND_TARGET} ${NOVA_CLEANUP_PMOND_SYMLINK}
if [ $? -ne 0 ]
then
log "Failed to create nova-cleanup symbolic link"
exit ${GENERIC_ERROR}
fi
fi
# There is interaction and timing between: e_nova-init, nova-startup,
# nova-cleanup, nova-compute, nova-goenabled. It is much simpler to
# let nova-goenabled detect when service is actually enabled.
# Clear the init failure flag prior to nova-cleanup.
rm ${NOVA_INIT_FAILED}
# Do in the background because of the long execution time.
log "Start Nova-Cleanup"
MAX_PID_WAIT=$((SECONDS+45))
timeout --signal KILL 300s /etc/init.d/nova-cleanup start &
while ! [ -f ${NOVA_CLEANUP_PID_FILE} ]
do
log "Waiting for Nova-Cleanup to start"
if [ ${SECONDS} -gt ${MAX_PID_WAIT} ]
then
log "Timeout waiting for Nova-Cleanup pid"
exit ${GENERIC_ERROR}
fi
sleep 1
done
NOVA_CLEANUP_PID=$(cat ${NOVA_CLEANUP_PID_FILE})
log "Nova-Cleanup pid ${NOVA_CLEANUP_PID} started"
log "Finished"
;;
stop)
log "Stop"
# Remove this just in case...
if [ -f ${NOVA_INIT_FAILED} ]
then
rm ${NOVA_INIT_FAILED}
fi
# Stop pmon monitoring of nova-compute
if [ -e ${NOVA_COMPUTE_PMOND_SYMLINK} ]
then
rm ${NOVA_COMPUTE_PMOND_SYMLINK}
fi
# Stop nova-compute
/etc/init.d/nova-compute stop
log "Finished"
;;
*)
echo "Usage: $0 {start|stop}"
exit ${INVALID_ARGS}
;;
esac
exit ${SUCCESS}

View File

@ -1,13 +0,0 @@
[Unit]
Description=Titanium Cloud Nova Init
After=network.target config.service worker-config-gate.service
Before=goenabled-worker.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/init.d/e_nova-init start
ExecStop=/etc/init.d/e_nova-init stop
[Install]
WantedBy=multi-user.target

View File

@ -1,25 +0,0 @@
[process]
service = libvirtd
process = libvirtd
pidfile = /var/run/libvirtd.pid
script = /etc/init.d/libvirtd
style = lsb ; ocf or lsb
severity = critical ; minor, major, critical
restarts = 3 ; restarts before error assertion
interval = 5 ; number of seconds to wait between restarts
debounce = 20 ; number of seconds that a process needs to remain
; running before degrade is removed and retry count
; is cleared.
startuptime = 5 ; Seconds to wait after process start before starting the debounce monitor
mode = passive ; Monitoring mode: passive (default) or active
; passive: process death monitoring (default: always)
; active : heartbeat monitoring, i.e. request / response messaging
; ignore : do not monitor or stop monitoring
subfunction = worker ; Optional label.
; Manage this process in the context of a combo host subfunction
; Choices: worker or storage.
; when specified pmond will wait for
; /var/run/.worker_config_complete or
; /var/run/.storage_config_complete
; ... before managing this process with the specified subfunction
; Excluding this label will cause this process to be managed by default on startup

View File

@ -1,200 +0,0 @@
#! /bin/bash
#
# Copyright (c) 2015-2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Linux Standard Base (LSB) Error Codes
SUCCESS=0
GENERIC_ERROR=1
INVALID_ARGS=2
NOVA_CLEANUP_TAG=${NOVA_CLEANUP_TAG:-"NOVA_CLEANUP"}
################################################################################
# Log message to user.log
################################################################################
function log
{
logger -p local1.info -t ${NOVA_CLEANUP_TAG} $@
}
################################################################################
# Exit abnormally
################################################################################
function exit_with_error
{
touch ${NOVA_CLEANUP_FAIL_FILE}
exit ${GENERIC_ERROR}
}
################################################################################
# Run Nova-Cleanup
################################################################################
nova_clean_up()
{
if [ -f ${NOVA_CLEANUP_FAIL_FILE} ]
then
rm -f ${NOVA_CLEANUP_FAIL_FILE}
fi
if [ ! -f "/etc/platform/.initial_config_complete" ]
then
log "Initial configuration is not complete, nothing to do"
return
fi
HOST_NAME=$(hostname)
timeout --signal KILL 15s /usr/bin/nfv-notify -n controller -p 30004 \
-t booting -d "{\"hostname\": \"${HOST_NAME}\"}" > /dev/null 2>&1
RET=$?
if [ ${RET} -eq 0 ]
then
# Controller is done cleaning up
log "Notified controller, controller is done cleaning up"
elif [ ${RET} -eq 254 ]
then
# Controller notified, but is not yet done cleaning up
log "Notified controller, controller is not done cleaning up"
touch ${NOVA_CLEANUP_FAIL_FILE}
else
log "Failed to notify controller, error=${RET}"
touch ${NOVA_CLEANUP_FAIL_FILE}
fi
}
################################################################################
# Main Entry
################################################################################
NOVA_RUN="/var/run/nova"
NOVA_CLEANUP_FAIL_FILE="${NOVA_RUN}/.nova_cleanup_fail"
NOVA_CLEANUP_DONE_FILE="${NOVA_RUN}/.nova_cleanup_done"
NOVA_COMPUTE_PID_FILE="${NOVA_RUN}/nova-compute.pid"
NOVA_CLEANUP_PID_FILE="${NOVA_RUN}/nova-cleanup.pid"
NOVA_COMPUTE_PMOND_TARGET="/etc/nova/nova-compute.conf"
NOVA_COMPUTE_PMOND_SYMLINK="/etc/pmon.d/nova-compute.conf"
NOVA_CLEANUP_PMOND_TARGET="/etc/nova/nova-cleanup.conf"
NOVA_CLEANUP_PMOND_SYMLINK="/etc/pmon.d/nova-cleanup.conf"
case "$1" in
start)
log "Start"
mkdir -p ${NOVA_RUN}
chown nova:root ${NOVA_RUN}
echo "$$" > ${NOVA_CLEANUP_PID_FILE}
if [ -f /etc/centos-release -a ! -L ${NOVA_COMPUTE_PID_FILE} ]; then
ln -sf /sys/fs/cgroup/systemd/system.slice/nova-compute.service/tasks ${NOVA_COMPUTE_PID_FILE}
fi
sleep 5
# Try for CONNECT_DELAY_SECS seconds to reach the controller
MAX_CONNECT_WAIT=$((SECONDS+240))
FOUND=0
while [ ${SECONDS} -lt ${MAX_CONNECT_WAIT} ]
do
ping -c 1 controller > /dev/null 2>&1 || ping6 -c 1 controller > /dev/null 2>&1
if [ $? -eq 0 ]
then
log "Connected to controller"
FOUND=1
break
fi
sleep 1
done
if [ ${FOUND} -eq 0 ]
then
# Controller is not yet available, just exit
log "Failed to connect to the controller"
exit ${GENERIC_ERROR}
fi
log "Connected to controller, starting cleanup"
while :
do
nova_clean_up
if [ ! -f ${NOVA_CLEANUP_FAIL_FILE} ]
then
log "Cleanup complete"
if ! [ -e $NOVA_COMPUTE_PMOND_SYMLINK ]
then
ln -s $NOVA_COMPUTE_PMOND_TARGET $NOVA_COMPUTE_PMOND_SYMLINK
if [ $? -ne 0 ]
then
log "Failed to create nova-compute symbolic link"
exit ${GENERIC_ERROR}
fi
fi
if [ -e $NOVA_CLEANUP_PMOND_SYMLINK ]
then
rm $NOVA_CLEANUP_PMOND_SYMLINK
fi
log "PMOND symlinks setup complete"
touch ${NOVA_CLEANUP_DONE_FILE}
break
fi
log "Sleeping for 10 seconds"
sleep 10
done
# Start Nova-Compute here to speed up the recovery of the
# compute, otherwise we will have to wait for pmond to start it.
log "Nova-Compute restart"
MAX_PID_WAIT=$((SECONDS+10))
timeout --signal KILL 10s /etc/init.d/nova-compute restart > /dev/null 2>&1
while ! [ -f ${NOVA_COMPUTE_PID_FILE} ]
do
log "Waiting for Nova-Compute to start"
if [ ${SECONDS} -gt ${MAX_PID_WAIT} ]
then
log "Timeout waiting for Nova-Compute pid"
exit ${GENERIC_ERROR}
fi
sleep 1
done
NOVA_COMPUTE_PID=$(head -1 ${NOVA_COMPUTE_PID_FILE})
log "Nova-Compute pid ${NOVA_COMPUTE_PID} started"
if [ -f ${NOVA_CLEANUP_PID_FILE} ]
then
rm ${NOVA_CLEANUP_PID_FILE}
fi
log "Finished"
;;
stop)
;;
*)
echo "Usage: $0 {start|stop}"
exit ${INVALID_ARGS}
;;
esac
exit ${SUCCESS}

View File

@ -1,25 +0,0 @@
[process]
process = nova-cleanup
service = nova-cleanup
pidfile = /var/run/nova/nova-cleanup.pid
script = /etc/init.d/nova-cleanup
style = lsb ; ocf or lsb
severity = critical ; minor, major, critical
restarts = 3 ; restarts before error assertion
interval = 5 ; number of seconds to wait between restarts
debounce = 360 ; number of seconds that a process needs to remain
; running before degrade is removed and retry count
; is cleared.
startuptime = 15 ; Seconds to wait after process start before starting the debounce monitor
mode = passive ; Monitoring mode: passive (default) or active
; passive: process death monitoring (default: always)
; active : heartbeat monitoring, i.e. request / response messaging
; ignore : do not monitor or stop monitoring
subfunction = worker ; Optional label.
; Manage this process in the context of a combo host subfunction
; Choices: worker or storage.
; when specified pmond will wait for
; /var/run/.worker_config_complete or
; /var/run/.storage_config_complete
; ... before managing this process with the specified subfunction
; Excluding this label will cause this process to be managed by default on startup

View File

@ -1,25 +0,0 @@
[process]
process = nova-compute
service = nova-compute
pidfile = /var/run/nova/nova-compute.pid
script = /etc/init.d/nova-startup
style = lsb ; ocf or lsb
severity = critical ; minor, major, critical
restarts = 3 ; restarts before error assertion
interval = 5 ; number of seconds to wait between restarts
debounce = 20 ; number of seconds that a process needs to remain
; running before degrade is removed and retry count
; is cleared.
startuptime = 15 ; Seconds to wait after process start before starting the debounce monitor
mode = passive ; Monitoring mode: passive (default) or active
; passive: process death monitoring (default: always)
; active : heartbeat monitoring, i.e. request / response messaging
; ignore : do not monitor or stop monitoring
subfunction = worker ; Optional label.
; Manage this process in the context of a combo host subfunction
; Choices: worker or storage.
; when specified pmond will wait for
; /var/run/.worker_config_complete or
; /var/run/.storage_config_complete
; ... before managing this process with the specified subfunction
; Excluding this label will cause this process to be managed by default on startup

View File

@ -1,74 +0,0 @@
#! /bin/bash
#
# Copyright (c) 2015-2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
### CONFIG_START
#
# Timeout: 300
#
### CONFIG_END
# Platform paths and flags
. /usr/bin/tsconfig
# Linux Standard Base (LSB) Error Codes
SUCCESS=0
GENERIC_ERROR=1
NOVA_GOENABLED_TAG=${NOVA_GOENABLED_TAG:-"NOVA_GOENABLED"}
log()
{
logger -p local1.info -t ${NOVA_GOENABLED_TAG} $@
}
NOVA_RUN="/var/run/nova"
NOVA_INIT_FAILED="${NOVA_RUN}/.nova_init_failed"
NOVA_COMPUTE_ENABLED="${NOVA_RUN}/.nova_compute_enabled"
NOVA_ADVANCE_ENABLED="/var/run/.nova_timer_advance_enabled"
case "$1" in
start)
if [ -e ${VOLATILE_WORKER_CONFIG_COMPLETE} ] && [ ! -e ${VOLATILE_DISABLE_WORKER_SERVICES} ]; then
log "Start"
if [ -e ${NOVA_INIT_FAILED} ]; then
log "Nova-Init check FAILED"
exit ${GENERIC_ERROR}
fi
log "Nova-Init check PASSED"
while [ true ]; do
if [ -e ${NOVA_ADVANCE_ENABLED} ]; then
log "Nova setup timer advance PASSED"
break
fi
sleep 1
done
while [ true ]; do
if [ -e ${NOVA_COMPUTE_ENABLED} ]; then
log "Nova-Compute service enabled PASSED"
break
fi
sleep 1
done
log "Finished"
fi
;;
stop)
;;
*)
;;
esac
exit ${SUCCESS}

View File

@ -1,13 +0,0 @@
[Unit]
Description=Titanium Cloud Nova Init
After=network.target config.service
Before=goenabled-worker.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/init.d/nova-init start
ExecStop=/etc/init.d/nova-init stop
[Install]
WantedBy=multi-user.target

View File

@ -1,111 +0,0 @@
#! /bin/bash
#
# Copyright (c) 2015-2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Linux Standard Base (LSB) Error Codes
SUCCESS=0
GENERIC_ERROR=1
INVALID_ARGS=2
NOVA_STARTUP_TAG=${NOVA_STARTUP_TAG:-"NOVA_STARTUP"}
function log
{
logger -p local1.info -t ${NOVA_STARTUP_TAG} $@
}
NOVA_RUN="/var/run/nova"
NOVA_CLEANUP_DONE_FILE="${NOVA_RUN}/.nova_cleanup_done"
NOVA_COMPUTE_ENABLED="${NOVA_RUN}/.nova_compute_enabled"
NOVA_COMPUTE_PID_FILE="${NOVA_RUN}/nova-compute.pid"
NOVA_CLEANUP_PID_FILE="${NOVA_RUN}/nova-cleanup.pid"
NOVA_COMPUTE_PMOND_TARGET="/etc/nova/nova-compute.conf"
NOVA_COMPUTE_PMOND_SYMLINK="/etc/pmon.d/nova-compute.conf"
NOVA_CLEANUP_PMOND_TARGET="/etc/nova/nova-cleanup.conf"
NOVA_CLEANUP_PMOND_SYMLINK="/etc/pmon.d/nova-cleanup.conf"
case "$1" in
start)
log "Start"
mkdir -p ${NOVA_RUN}
chown nova:root ${NOVA_RUN}
if [ -f ${NOVA_COMPUTE_ENABLED} ]
then
rm ${NOVA_COMPUTE_ENABLED}
fi
if [ -f ${NOVA_CLEANUP_PID_FILE} ]
then
NOVA_CLEANUP_PID=$(cat ${NOVA_CLEANUP_PID_FILE})
log "About to kill ${NOVA_CLEANUP_PID}"
kill -9 ${NOVA_CLEANUP_PID}
log "Killed ${NOVA_CLEANUP_PID}"
rm ${NOVA_CLEANUP_PID_FILE}
fi
if [ -f ${NOVA_CLEANUP_DONE_FILE} ]
then
log "Nova-Cleanup already complete"
if [ -e $NOVA_CLEANUP_PMOND_SYMLINK ]
then
rm $NOVA_CLEANUP_PMOND_SYMLINK
fi
log "Nova-Compute restart"
# Do in the foreground because the nova-compute script wipes
# and recreates the pid file for nova-compute. Otherwise
# you could be looking at a stale pid file.
timeout --signal KILL 10s /etc/init.d/nova-compute restart > /dev/null 2>&1
while ! [ -f ${NOVA_COMPUTE_PID_FILE} ]
do
log "Waiting for Nova-Compute to start"
sleep 1
done
NOVA_COMPUTE_PID=$(head -1 ${NOVA_COMPUTE_PID_FILE})
log "Nova-Compute pid ${NOVA_COMPUTE_PID} started"
else
log "Nova-Cleanup is needed"
# Do in the background because of the long execution time.
timeout --signal KILL 300s /etc/init.d/nova-cleanup start &
while ! [ -f ${NOVA_CLEANUP_PID_FILE} ]
do
log "Waiting for Nova-Cleanup to start"
sleep 1
done
NOVA_CLEANUP_PID=$(cat ${NOVA_CLEANUP_PID_FILE})
log "Nova-Cleanup pid ${NOVA_CLEANUP_PID} started"
fi
log "Finished"
;;
stop)
;;
restart|force-reload|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|reload}"
exit $INVALID_ARGS
;;
esac
exit $SUCCESS