Merge "Removing unused flag disable_worker_services"
This commit is contained in:
commit
bbe14d1de2
@ -26,8 +26,6 @@ INITIAL_CONFIG_COMPLETE_FLAG=${PLATFORM_CONF_PATH}/.initial_config_complete
|
||||
INITIAL_WORKER_CONFIG_COMPLETE=${PLATFORM_CONF_PATH}/.initial_worker_config_complete
|
||||
# Set after each application of worker manifests
|
||||
VOLATILE_WORKER_CONFIG_COMPLETE=${VOLATILE_PATH}/.worker_config_complete
|
||||
# Set to prevent starting worker services (used in combined node upgrade)
|
||||
VOLATILE_DISABLE_WORKER_SERVICES=${VOLATILE_PATH}/.disable_worker_services
|
||||
|
||||
# Upgrade flags
|
||||
|
||||
|
@ -196,9 +196,6 @@ INITIAL_WORKER_CONFIG_COMPLETE = os.path.join(
|
||||
# Set after each application of worker manifests
|
||||
VOLATILE_WORKER_CONFIG_COMPLETE = os.path.join(
|
||||
VOLATILE_PATH, ".worker_config_complete")
|
||||
# Set to prevent starting worker services (used in combined node upgrade)
|
||||
VOLATILE_DISABLE_WORKER_SERVICES = os.path.join(
|
||||
VOLATILE_PATH, ".disable_worker_services")
|
||||
|
||||
# Storage configuration flags
|
||||
|
||||
|
@ -12,7 +12,6 @@ install:
|
||||
install -d -m 755 $(SYSTEMDDIR)
|
||||
install -d -m 755 $(SYSTEMDDIR)/config
|
||||
install -p -D -m 700 worker_config $(INITDDIR)/worker_config
|
||||
install -p -D -m 700 worker_services $(INITDDIR)/worker_services
|
||||
install -p -D -m 755 config_goenabled_check.sh $(GOENABLEDDIR)/config_goenabled_check.sh
|
||||
install -p -D -m 664 workerconfig.service $(SYSTEMDDIR)/config/workerconfig-standalone.service
|
||||
install -p -D -m 664 workerconfig-combined.service $(SYSTEMDDIR)/config/workerconfig-combined.service
|
||||
|
@ -294,69 +294,6 @@ start()
|
||||
fi
|
||||
fi
|
||||
|
||||
# Upgrade related checks for controller-1 in combined controller/worker
|
||||
if [ "$nodetype" = "controller" -a "$HOST" = "controller-1" ]
|
||||
then
|
||||
# Check controller activity.
|
||||
# Prior to the final compile of R5 the service check below had been
|
||||
# against platform-nfs-ip. However, there was a worker
|
||||
# subfunction configuration failure when an AIO-DX system controller
|
||||
# booted up while there was no pingable backup controller. Seems the
|
||||
# platform-nfs-ip service was not always reaching the enabled-active
|
||||
# state when this check was performed under this particular failure.
|
||||
# Seems an earlier launched service of like functionality, namely
|
||||
# 'platform-export-fs' is reliably enabled at this point there-by
|
||||
# resolving the issue.
|
||||
sm-query service platform-export-fs | grep enabled-active > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
# This controller is not active so it is safe to check the version
|
||||
# of the mate controller.
|
||||
VOLATILE_ETC_PLATFORM_MOUNT=$VOLATILE_PATH/etc_platform
|
||||
mkdir $VOLATILE_ETC_PLATFORM_MOUNT
|
||||
nfs-mount controller-0:/etc/platform $VOLATILE_ETC_PLATFORM_MOUNT
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
# Check whether software versions match on the two controllers
|
||||
MATE_SW_VERSION=$(source $VOLATILE_ETC_PLATFORM_MOUNT/platform.conf && echo $sw_version)
|
||||
if [ $SW_VERSION != $MATE_SW_VERSION ]
|
||||
then
|
||||
echo "Controllers are running different software versions"
|
||||
echo "SW_VERSION: $SW_VERSION MATE_SW_VERSION: $MATE_SW_VERSION"
|
||||
|
||||
# Since controller-1 is always upgraded first (and downgraded
|
||||
# last), we know that controller-1 is running a higher release
|
||||
# than controller-0.
|
||||
# This controller is not active and is running a higher
|
||||
# release than the mate controller, so do not launch
|
||||
# any of the worker services (they will not work with
|
||||
# a lower version of the controller services).
|
||||
echo "Disabling worker services until controller activated"
|
||||
touch $VOLATILE_DISABLE_WORKER_SERVICES
|
||||
|
||||
# Copy $PLATFORM_DIR into a temporary location for the worker_services script to
|
||||
# access. This is only required for CPE upgrades
|
||||
rm -rf $VOLATILE_PLATFORM_PATH
|
||||
mkdir -p $VOLATILE_PLATFORM_PATH
|
||||
cp -Rp $PLATFORM_DIR/* $VOLATILE_PLATFORM_PATH/
|
||||
|
||||
fi
|
||||
umount $VOLATILE_ETC_PLATFORM_MOUNT
|
||||
rmdir $VOLATILE_ETC_PLATFORM_MOUNT
|
||||
else
|
||||
rmdir $VOLATILE_ETC_PLATFORM_MOUNT
|
||||
fatal_error "Unable to mount /etc/platform"
|
||||
fi
|
||||
else
|
||||
# Controller-1 (CPE) is active and is rebooting. This is probably a DOR. Since this
|
||||
# could happen during an upgrade, we will copy $PLATFORM_DIR into a temporary
|
||||
# location for the worker_services script to access in case of a future swact.
|
||||
rm -rf $VOLATILE_PLATFORM_PATH
|
||||
mkdir -p $VOLATILE_PLATFORM_PATH
|
||||
cp -Rp $PLATFORM_DIR/* $VOLATILE_PLATFORM_PATH/
|
||||
fi
|
||||
fi
|
||||
|
||||
# Apply the puppet manifest
|
||||
HOST_HIERA=${PUPPET_PATH}/hieradata/${IPADDR}.yaml
|
||||
if [ -f ${HOST_HIERA} ]; then
|
||||
|
@ -1,229 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2016-2018 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
#
|
||||
# This script provides support for CPE upgrades. It will be called during swacts
|
||||
# by the /usr/local/sbin/sm-notification python script, if we are in a small
|
||||
# footprint system (CPE)
|
||||
#
|
||||
# During a swact to, the script will delete the $VOLATILE_DISABLE_WORKER_SERVICES
|
||||
# flag and re-apply the worker manifests.
|
||||
# During a swact away from (downgrades), the script re-create the
|
||||
# $VOLATILE_DISABLE_WORKER_SERVICES flag and re-apply the worker manifests.
|
||||
#
|
||||
# This script should only re-apply the worker manifests if;
|
||||
# - It is running on a CPE (small footprint) system
|
||||
# - It is controller-1
|
||||
# - Controller-0 has not yet been upgraded
|
||||
#
|
||||
# This script logs to /var/log/platform.log
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: worker_services
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Worker node services agent
|
||||
### END INIT INFO
|
||||
|
||||
. /usr/bin/tsconfig
|
||||
. /etc/platform/platform.conf
|
||||
|
||||
VOLATILE_CONFIG_PASS="/var/run/.config_pass"
|
||||
VOLATILE_CONFIG_FAIL="/var/run/.config_fail"
|
||||
|
||||
IN_PROGRESS="/var/run/.worker_services_in_progress"
|
||||
|
||||
TEMP_MATE_ETC_DIR="$VOLATILE_PATH/etc_platform_worker"
|
||||
TEMP_PUPPET_DIR="$VOLATILE_PATH/puppet_worker"
|
||||
|
||||
# Copy of /opt/platform populate by worker_config
|
||||
VOLATILE_PLATFORM_PATH=$VOLATILE_PATH/cpe_upgrade_opt_platform
|
||||
|
||||
# Process id and full filename of this executable
|
||||
NAME="[$$] $0($1)"
|
||||
|
||||
end_exec()
|
||||
{
|
||||
rm $IN_PROGRESS
|
||||
exit 0
|
||||
}
|
||||
|
||||
init()
|
||||
{
|
||||
local action_to_perform=$1
|
||||
|
||||
# This will log to /var/log/platform.log
|
||||
logger -t $NAME -p local1.info "Begin ..."
|
||||
|
||||
# Check if this program is currently executing, if so sleep for 5 seconds and check again.
|
||||
# After 10 minutes of waiting assume something is wrong and exit.
|
||||
count=0
|
||||
while [ -f $IN_PROGRESS ] ; do
|
||||
if [ $count -gt 120 ] ; then
|
||||
logger -t $NAME -p local1.error "Execution completion of previous call is taking more than 10 minutes. Exiting."
|
||||
end_exec
|
||||
fi
|
||||
logger -t $NAME -p local1.info "Sleep for 5 seconds"
|
||||
let count++
|
||||
sleep 5
|
||||
done
|
||||
|
||||
touch $IN_PROGRESS
|
||||
|
||||
HOST=$(hostname)
|
||||
if [ -z "$HOST" -o "$HOST" = "localhost" ] ; then
|
||||
logger -t $NAME -p local1.error "Host undefiled"
|
||||
end_exec
|
||||
fi
|
||||
|
||||
# this script should only be performed on controller-1
|
||||
if [ "$HOST" != "controller-1" ] ; then
|
||||
logger -t $NAME -p local1.info "Exiting because this is not controller-1"
|
||||
end_exec
|
||||
fi
|
||||
|
||||
# This script should only be called if we are in a CPE system
|
||||
sub_function=`echo "$subfunction" | cut -f 2 -d','`
|
||||
if [ $sub_function != "worker" ] ; then
|
||||
logger -t $NAME -p local1.error "Exiting because this is not CPE host"
|
||||
end_exec
|
||||
fi
|
||||
|
||||
# Exit if called while the config worker success flag file is not present
|
||||
if [ ! -f $VOLATILE_CONFIG_PASS ] ; then
|
||||
logger -t $NAME -p local1.info "Exiting due to non-presence of $VOLATILE_CONFIG_PASS file"
|
||||
end_exec
|
||||
fi
|
||||
|
||||
# Exit if called while the config worker failure flag file is present
|
||||
if [ -f $VOLATILE_CONFIG_FAIL ] ; then
|
||||
logger -t $NAME -p local1.info "Exiting due to presence of $VOLATILE_CONFIG_FAIL file"
|
||||
end_exec
|
||||
fi
|
||||
|
||||
# Ensure we only run if the controller config is complete
|
||||
if [ ! -f /etc/platform/.initial_controller_config_complete ] ; then
|
||||
logger -t $NAME -p local1.warn "exiting because CPE controller that has not completed initial config"
|
||||
end_exec
|
||||
fi
|
||||
|
||||
IPADDR=$(cat /etc/hosts | awk -v host=$HOST '$2 == host {print $1}')
|
||||
if [ -z "$IPADDR" ] ; then
|
||||
logger -t $NAME -p local1.error "Unable to get IP from host: $HOST"
|
||||
end_exec
|
||||
fi
|
||||
|
||||
# The platform filesystem was mounted in worker_config and copied in a temp
|
||||
# location
|
||||
if [ ! -f $VOLATILE_PLATFORM_PATH/config/${SW_VERSION}/hosts ] ; then
|
||||
logger -t $NAME -p local1.error "Error accessing $VOLATILE_PLATFORM_PATH"
|
||||
end_exec
|
||||
fi
|
||||
|
||||
# Check the release version of controller-0
|
||||
mkdir $TEMP_MATE_ETC_DIR
|
||||
|
||||
nfs-mount controller-0:/etc/platform $TEMP_MATE_ETC_DIR
|
||||
if [ $? -eq 0 ] ; then
|
||||
# Should only be executed when the releases do not match
|
||||
MATE_SW_VERSION=$(source $TEMP_MATE_ETC_DIR/platform.conf && echo $sw_version)
|
||||
|
||||
logger -t $NAME -p local1.info "SW_VERSION: $SW_VERSION MATE_SW_VERSION: $MATE_SW_VERSION"
|
||||
|
||||
# Check whether software versions match on the two controllers
|
||||
# Since controller-1 is always upgraded first (and downgraded
|
||||
# last), we know that controller-1 is running a higher release
|
||||
# than controller-0.
|
||||
if [ $SW_VERSION == $MATE_SW_VERSION ] ; then
|
||||
logger -t $NAME -p local1.info "Releases matches... do not continue"
|
||||
umount $TEMP_MATE_ETC_DIR
|
||||
rmdir $TEMP_MATE_ETC_DIR
|
||||
end_exec
|
||||
fi
|
||||
else
|
||||
logger -t $NAME -p local1.error "Unable to mount /etc/platform"
|
||||
rmdir $TEMP_MATE_ETC_DIR
|
||||
end_exec
|
||||
fi
|
||||
|
||||
umount $TEMP_MATE_ETC_DIR
|
||||
rmdir $TEMP_MATE_ETC_DIR
|
||||
|
||||
# Copy the puppet data into $TEMP_PUPPET_DIR
|
||||
|
||||
VOLATILE_PUPPET_PATH=${VOLATILE_PLATFORM_PATH}/puppet/${SW_VERSION}
|
||||
logger -t $NAME -p local1.info "VOLATILE_PUPPET_PATH = $VOLATILE_PUPPET_PATH"
|
||||
|
||||
rm -rf $TEMP_PUPPET_DIR
|
||||
cp -R $VOLATILE_PUPPET_PATH $TEMP_PUPPET_DIR
|
||||
if [ $? -ne 0 ] ; then
|
||||
logger -t $NAME -p local1.error "Failed to copy packstack directory $VOLATILE_PUPPET_PATH to $TEMP_PUPPET_DIR "
|
||||
end_exec
|
||||
fi
|
||||
|
||||
# Update the VOLATILE_DISABLE_WORKER_SERVICES flag and stop nova-compute if in "stop"
|
||||
if [ $action_to_perform == "stop" ] ; then
|
||||
logger -t $NAME -p local1.info "Disabling compute services"
|
||||
|
||||
# Set the worker services disable flag used by the manifest
|
||||
touch $VOLATILE_DISABLE_WORKER_SERVICES
|
||||
|
||||
# Stop nova-compute
|
||||
logger -t $NAME -p local1.info "Stopping nova-compute"
|
||||
/etc/init.d/e_nova-init stop
|
||||
else
|
||||
logger -t $NAME -p local1.info "Enabling compute services"
|
||||
|
||||
# Clear the worker services disable flag used by the manifest
|
||||
rm $VOLATILE_DISABLE_WORKER_SERVICES
|
||||
fi
|
||||
|
||||
# Apply the puppet manifest
|
||||
HOST_HIERA=${TEMP_PUPPET_DIR}/hieradata/${IPADDR}.yaml
|
||||
if [ -f ${HOST_HIERA} ]; then
|
||||
echo "$0: Running puppet manifest apply"
|
||||
puppet-manifest-apply.sh ${TEMP_PUPPET_DIR}/hieradata ${IPADDR} worker
|
||||
RC=$?
|
||||
if [ $RC -ne 0 ];
|
||||
then
|
||||
logger -t $NAME -p local1.info "Failed to run the puppet manifest (RC:$RC)"
|
||||
end_exec
|
||||
fi
|
||||
else
|
||||
logger -t $NAME -p local1.info "Host configuration not yet available for this node ($(hostname)=${IPADDR}); aborting configuration."
|
||||
end_exec
|
||||
fi
|
||||
|
||||
# Start nova-compute is we are starting compute services
|
||||
if [ $action_to_perform == "start" ] ; then
|
||||
logger -t $NAME -p local1.info "Starting nova-compute"
|
||||
/etc/init.d/e_nova-init start
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
rm -rf $TEMP_PUPPET_DIR
|
||||
|
||||
logger -t $NAME -p local1.info "... Done"
|
||||
end_exec
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
init $1
|
||||
;;
|
||||
stop)
|
||||
init $1
|
||||
;;
|
||||
*)
|
||||
logger -t $NAME -p local1.info "Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
end_exec
|
Loading…
Reference in New Issue
Block a user