Set up a combination plugin

* Set some (stx-)global configuration
* Define the stx-minimal-devstack-base job
* Use stx-update and stx-integ plugins as-is
* Copy stx-fault, stx-config and stx-metal here and validate
  running external plugins

Change-Id: I554b20d83dce8c0fbad67785bb04232be8c10183
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
This commit is contained in:
Dean Troyer 2019-03-04 14:17:44 -06:00
parent d513e5cb27
commit 066726ea2b
9 changed files with 2072 additions and 3 deletions

View File

@ -1,3 +1,107 @@
- project:
templates:
- noop-jobs
check:
jobs:
- openstack-tox-linters
- stx-devstack-test1:
voting: false
gate:
jobs:
- openstack-tox-linters
- stx-devstack-test1:
voting: false
# This job is to begin testing a DevStack run here
- job:
name: stx-minimal-devstack-base
nodeset: openstack-single-node-bionic
parent: devstack
description: |
Common job template for StarlingX DevStack tests with most OpenStack
services disabled
roles:
- zuul: openstack-infra/devstack
timeout: 9000
required-projects:
- name: git.openstack.org/openstack-dev/devstack
- name: git.openstack.org/openstack/keystone
- name: git.openstack.org/openstack/requirements
vars:
devstack_services:
# Turn off most OpenStack services
# Ceilometer services
ceilometer-acentral: false
ceilometer-acompute: false
ceilometer-alarm-evaluator: false
ceilometer-alarm-notifier: false
ceilometer-anotification: false
ceilometer-api: false
ceilometer-collector: false
# Cinder services
c-api: false
c-bak: false
c-sch: false
c-vol: false
cinder: false
# Glance services
g-api: false
g-reg: false
# Horizon services
horizon: false
# Neutron services
q-agt: true
q-dhcp: false
q-l3: false
q-meta: false
q-metering: false
q-svc: false
# Nova services
n-api: false
n-api-meta: false
n-cauth: false
n-cond: false
n-cpu: false
n-novnc: false
n-obj: false
n-sch: false
placement-api: false
# Swift services
s-account: false
s-container: false
s-object: false
s-proxy: false
tempest: false
# Database
mysql: false
postgresql: true
devstack_localrc:
LIBS_FROM_GIT: keystone
FORCE: yes
- job:
name: stx-devstack-test1
parent: stx-minimal-devstack-base
description: |
Sanity check on DevStack plugin configuration - enable plugins
but only a few services
timeout: 7800
required-projects:
- name: openstack/stx-config
- name: openstack/stx-fault
- name: openstack/stx-integ
- name: openstack/stx-update
vars:
tox_envlist: functional
devstack_services:
stx-config: true
cgtsclient: true
stx-fault: true
fm-common: true
fm-api: true
fm-rest-api: true
# fm-mgr: true
devstack_plugins:
stx-tis-repo: git://git.starlingx.io/stx-tis-repo
stx-integ: git://git.starlingx.io/stx-integ
stx-update: git://git.starlingx.io/stx-update
devstack_localrc:
LIBS_FROM_GIT: keystone

View File

@ -1,4 +1,12 @@
stx-tis-repo
============
Placeholder repo
This repo is being used for development of DevStack plugins
for StarlingX flock services. It is not used in the build
or operation of StarlingX in any way in spite of it having
that resembles a historical repo for this project.
The reason for doing this separate form the service plugins
is that there are some interesting dependencies between the
plugins and the base stx devstack job should be not in one of
the service repos.

357
devstack/lib/stx-config Normal file
View File

@ -0,0 +1,357 @@
#!/bin/bash
#
# lib/stx-config
# Functions to control the configuration and operation of stx-config
# Dependencies:
#
# - ``functions`` file
# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
# - The stx-update and stx-fault plugins must be enabled
# ``stack.sh`` calls the entry points in this order:
#
# - install_config
# - configure_config
# - init_config
# - start_config
# - stop_config
# - cleanup_config
_XTRACE_STX_CONFIG=$(set +o | grep xtrace)
set -o xtrace
# Defaults
# --------
STX_CONFIG_DIR=${GITDIR[$STX_CONFIG_NAME]}
STX_SYSCONFDIR=${STX_SYSCONFDIR:-/etc}
# Set up GITDIR so setup_lib and setup_dev_lib work properly
GITDIR["cgts-client"]=$STX_CONFIG_DIR/sysinv/cgts-client/cgts-client
STX_CONF_UTILS_DIR=$STX_CONFIG_DIR/configutilities/configutilities
STX_CTRL_CONF_DIR=$STX_CONFIG_DIR/controllerconfig/controllerconfig
SYSINV_DIR=$STX_CONFIG_DIR/sysinv/sysinv/sysinv
SYSINV_AGENT_DIR=$STX_CONFIG_DIR/sysinv/sysinv-agent
SYSINV_CONF_DIR=$STX_SYSCONFDIR/sysinv
SYSINV_CONF_FILE=$SYSINV_CONF_DIR/sysinv.conf
SYSINV_SERVICE_PROTOCOL=${SYSINV_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
SYSINV_SERVICE_PORT=${SYSINV_SERVICE_PORT:-6385}
SYSINV_SERVICE_HOST=${SYSINV_SERVICE_HOST:-$SERVICE_HOST}
SYSINV_ETC_GOENABLEDD=/etc/goenabled.d
SYSINV_API_PASTE_INI=$SYSINV_CONF_DIR/api-paste.ini
SYSINV_ETC_MOTDD=/etc/motd.d
SYSINV_API_PORT=$SYSINV_SERVICE_PORT
SYSINV_AUTH_STRATEGY=${SYSINV_AUTH_STRATEGY:-keystone}
SYSINV_AUTH_CACHE_DIR=${SYSINV_AUTH_CACHE_DIR:-/var/cache/sysinv}
# STX_INST_DIR should be a non-root-writable place to install build artifacts
STX_INST_DIR=${STX_INST_DIR:-/usr/local}
STX_BIN_DIR=${STX_BIN_DIR:-$STX_INST_DIR/bin}
STX_SBIN_DIR=${STX_SBIN_DIR:-$STX_INST_DIR/sbin}
# Set up so we don't use sudo for installs when not necessary
STX_SUDO="sudo"
[[ -w $STX_INST_DIR ]] && STX_SUDO="env"
PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
STX_OCF_ROOT=${STX_OCF_ROOT:-/usr/lib/ocf}
# Functions
# ---------
function check_sysinv_services {
local stx_services="sysinv-api sysinv-cond sysinv-agent"
local service
for service in $stx_services; do
if [[is_service_enabled $service && $SYSTEMCTL is-enabled devstack@$service.service]]; then
$SYSTEMCTL status devstack@$service.service --no-pager
fi
done
}
function cleanup_cgtsclient {
pip_uninstall cgtsclient
}
function cleanup_config {
if is_service_enabled sysinv; then
cleanup_sysinv
cleanup_configutilities
cleanup_controllerconfig
fi
if is_service_enabled cgtsclient; then
cleanup_cgtsclient
fi
}
function cleanup_configutilities {
pip_uninstall configutilities
}
function cleanup_controllerconfig {
pip_uninstall controllerconfig
sudo rm -f /etc/bash_completion.d/system.bash_completion
}
function cleanup_sysinv {
stop_sysinv
pip_uninstall sysinv
sudo rm -f $SYSINV_ETC_GOENABLEDD/sysinv_goenabled_check.sh
sudo rm -f $SYSINV_CONF_DIR/policy.json
sudo rm -f $SYSINV_CONF_DIR/profileSchema.xsd
sudo rm -f $SYSINV_ETC_MOTDD/10-system
sudo rm -f $SYSINV_CONF_DIR/upgrades/delete_load.sh
sudo rm -f $STX_OCF_ROOT/resource.d/platform/sysinv-api
sudo rm -f $STX_OCF_ROOT/resource.d/platform/sysinv-conductor
sudo rm -f $STX_SYSCONFDIR/systemd/system/sysinv-api.service
sudo rm -f $STX_SYSCONFDIR/systemd/system/sysinv-conductor.service
sudo rm -f $STX_BIN_DIR/partition_info.sh
sudo rm -f $STX_BIN_DIR/manage-partitions
sudo rm -f $STX_BIN_DIR/query_pci_id
sudo rm -rf $SYSINV_AUTHO_CACHE_DIR $SYSINV_CONF_DIR
}
function configure_config {
if is_service_enabled sysinv; then
configure_sysinv
create_sysinv_user_group
create_sysinv_accounts
fi
}
function configure_sysinv {
sudo install -d -o $STACK_USER $SYSINV_CONF_DIR
cp $SYSINV_DIR/etc/sysinv/sysinv.conf.sample $SYSINV_CONF_FILE
iniset $SYSINV_CONF_FILE DEFAULT MTC_INV_LABLE /v1/hosts/
iniset $SYSINV_CONF_FILE DEFAULT sysinv_api_port $SYSINV_API_PORT
iniset $SYSINV_CONF_FILE DEFAULT use_syslog True
iniset $SYSINV_CONF_FILE DEFAULT rabbit_host $RABBIT_HOST
iniset $SYSINV_CONF_FILE DEFAULT rabbit_hosts $RABBIT_HOST:5672
iniset $SYSINV_CONF_FILE DEFAULT rabbit_port 5672
iniset $SYSINV_CONF_FILE DEFAULT verbose True
iniset $SYSINV_CONF_FILE DEFAULT sysinv_api_bind_ip $HOST_IP
iniset $SYSINV_CONF_FILE DEFAULT auth_strategy $SYSINV_AUTH_STRATEGY
iniset $SYSINV_CONF_FILE DEFAULT control_exchange openstack
iniset $SYSINV_CONF_FILE DEFAULT rabbit_userid $RABBIT_USERID
iniset $SYSINV_CONF_FILE DEFAULT rabbit_virtual_host /
iniset $SYSINV_CONF_FILE DEFAULT api_paste_config $CINDER_API_PASTE_INI
iniset $SYSINV_CONF_FILE DEFAULT debug True
iniset $SYSINV_CONF_FILE DEFAULT rabbit_password $RABBIT_PASSWORD
# transport_url is not in config files, so we don't need call iniset_rpc_backend
# iniset_rpc_backend sysinv $SYSINV_CONF_FILE
iniset $SYSINV_CONF_FILE DEFAULT rabbit_ha_queues False
setup_logging $SYSINV_CONF_FILE
configure_auth_token_middleware $SYSINV_CONF_FILE sysinv $SYSINV_AUTH_CACHE_DIR/api
iniset $SYSINV_CONF_FILE database connection `database_connection_url sysinv`
}
function create_sysinv_accounts {
get_or_create_service "sysinv" "platform" "SysInv services"
create_service_user "sysinv" "admin"
sysinv_api_url="$SYSINV_SERVICE_PROTOCOL://$SYSINV_SERVICE_HOST:$SYSINV_SERVICE_PORT"
get_or_create_endpoint \
"sysinv" \
"$REGION_NAME" \
"$sysinv_api_url/v1"
}
# create_sysinv_cache_dir() - Part of the init_sysinv() process
function create_sysinv_cache_dir {
# Create cache dir
sudo mkdir -p $SYSINV_AUTH_CACHE_DIR/api
sudo chown $STACK_USER $SYSINV_AUTH_CACHE_DIR/api
rm -f $SYSINV_AUTH_CACHE_DIR/api/*
sudo mkdir -p $SYSINV_AUTH_CACHE_DIR/registry
sudo chown $STACK_USER $SYSINV_AUTH_CACHE_DIR/registry
rm -f $SYSINV_AUTH_CACHE_DIR/registry/*
}
function create_sysinv_user_group {
if ! getent group sysinv >/dev/null; then
sudo groupadd sysinv
fi
if ! getent passwd sysinv >/dev/null; then
sudo mkdir -p /home/sysinv
sudo useradd -g sysinv -s /bin/bash -d /home/sysinv -m sysinv
echo "Giving user sysinv passwordless sudo privileges"
# UEC images ``/etc/sudoers`` does not have a ``#includedir``, add one
sudo grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers ||
sudo echo "#includedir /etc/sudoers.d" >> /etc/sudoers
# Set up DevStack sudoers
TEMPFILE=`mktemp`
echo "sysinv ALL=(root) NOPASSWD:ALL" >$TEMPFILE
# Some binaries might be under ``/sbin`` or ``/usr/sbin``, so make sure sudo will
# see them by forcing ``PATH``
echo "Defaults:sysinv secure_path=/sbin:/usr/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin" >> $TEMPFILE
echo "Defaults:sysinv !requiretty" >> $TEMPFILE
chmod 0440 $TEMPFILE
sudo chown root:root $TEMPFILE
sudo mv $TEMPFILE /etc/sudoers.d/60_sysinv_sh
fi
}
function init_config {
if is_service_enabled sysinv; then
# Migrations need this
sudo install -d -m 755 -o ${USER} /var/run/sysinv
if [[ "$HOST_TOPOLOGY_ROLE" != "subnode" ]]; then
# (Re)create sysinv database
echo "recreate_database sysinv and dbsync"
recreate_database sysinv
$STX_BIN_DIR/sysinv-dbsync --config-file=$SYSINV_CONF_FILE
fi
create_sysinv_cache_dir
fi
}
function install_cgtsclient {
setup_dev_lib "cgts-client"
sudo install -D -m 0644 -o $STACK_USER {${GITDIR["cgts-client"]}/tools/,/etc/bash_completion.d/}system.bash_completion
}
function install_config {
if is_service_enabled cgtsclient; then
install_cgtsclient
fi
if is_service_enabled sysinv; then
install_configutilities
install_controllerconfig
install_sysinv
fi
if is_service_enabled sysinv-agent; then
install_sysinv_agent
fi
}
function install_configutilities {
# We can't use setup_develop as there is no setup.cfg file present for configutilities
setup_package $STX_CONF_UTILS_DIR -e
}
function install_controllerconfig {
# This is a hack to work around the lack of proper global-requirements
# setup in these packages
pip_install pycrypto
# We can't use setup_develop as there is no setup.cfg file present for controllerconfig
setup_package $STX_CTRL_CONF_DIR -e
}
function install_sysinv {
setup_develop $SYSINV_DIR
sudo install -d -m 755 $SYSINV_ETC_GOENABLEDD
sudo install -p -D -m 755 $SYSINV_DIR/etc/sysinv/sysinv_goenabled_check.sh $SYSINV_ETC_GOENABLEDD/sysinv_goenabled_check.sh
sudo install -d -m 755 $SYSINV_CONF_DIR
sudo install -p -D -m 755 $SYSINV_DIR/etc/sysinv/policy.json $SYSINV_CONF_DIR/policy.json
sudo install -p -D -m 640 $SYSINV_DIR/etc/sysinv/profileSchema.xsd $SYSINV_CONF_DIR/profileSchema.xsd
sudo install -d -m 755 $SYSINV_ETC_MOTDD
sudo install -p -D -m 755 $SYSINV_DIR/etc/sysinv/motd-system $SYSINV_ETC_MOTDD/10-system
sudo install -d -m 755 $SYSINV_CONF_DIR/upgrades
sudo install -p -D -m 755 $SYSINV_DIR/etc/sysinv/delete_load.sh $SYSINV_CONF_DIR/upgrades/delete_load.sh
sudo install -p -D -m 755 $SYSINV_DIR/scripts/sysinv-api $STX_OCF_ROOT/resource.d/platform/sysinv-api
sudo install -p -D -m 755 $SYSINV_DIR/scripts/sysinv-conductor $STX_OCF_ROOT/resource.d/platform/sysinv-conductor
sudo install -p -D -m 755 $SYSINV_DIR/scripts/sysinv-api.service $STX_SYSCONFDIR/systemd/system/sysinv-api.service
sudo install -p -D -m 755 $SYSINV_DIR/scripts/sysinv-conductor.service $STX_SYSCONFDIR/systemd/system/sysinv-conductor.service
sudo install -d -m 755 $STX_BIN_DIR
sudo install -p -D -m 755 $SYSINV_DIR/sysinv/cmd/partition_info.sh $STX_BIN_DIR/partition_info.sh
sudo install -p -D -m 755 $SYSINV_DIR/sysinv/cmd/manage-partitions $STX_BIN_DIR/manage-partitions
sudo install -p -D -m 755 $SYSINV_DIR/sysinv/cmd/query_pci_id $STX_BIN_DIR/query_pci_id
}
function install_sysinv_agent {
#rename to sysinv-agent.sh to avoid overwrite entry_point of sysinv-agent
sudo install -p -D -m 755 $SYSINV_AGENT_DIR/sysinv-agent $STX_BIN_DIR/sysinv-agent.sh
}
function start_config {
if is_service_enabled sysinv; then
start_sysinv
fi
}
function start_sysinv {
if is_service_enabled sysinv-api; then
start_sysinv_api
fi
if is_service_enabled sysinv-cond; then
start_sysinv_conductor
fi
if is_service_enabled sysinv-agent; then
start_sysinv_agent
fi
}
function start_sysinv_agent {
run_process sysinv-agent "$STX_BIN_DIR/sysinv-agent"
}
function start_sysinv_api {
run_process sysinv-api "$STX_BIN_DIR/sysinv-api --config-file=$SYSINV_CONF_FILE"
# Get right service port for testing
local service_port=$SYSINV_SERVICE_PORT
local service_protocol=$SYSINV_SERVICE_PROTOCOL
if is_service_enabled tls-proxy; then
service_port=$SYSINV_SERVICE_PORT
service_protocol="http"
fi
echo "Waiting for sysinv-api ($SERVICE_HOST:$service_port) to start..."
if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- $service_protocol://$SERVICE_HOST:$service_port/; do sleep 1; done"; then
die $LINENO "sysinv-api did not start"
fi
if is_service_enabled tls-proxy; then
start_tls_proxy sysinv '*' $SYSINV_SERVICE_PORT $SERVICE_HOST $SYSINV_SERVICE_PORT
fi
}
function start_sysinv_conductor {
# the 1st will fail
stop_sysinv_conductor
run_process sysinv-cond "$STX_BIN_DIR/sysinv-conductor --config-file=$SYSINV_CONF_FILE"
# TODO: Find a way to check whether the conductor has started.
# TODO: first run in extra stage will fail, need run second time in test-config
}
function stop_config {
if is_service_enabled sysinv; then
stop_sysinv
fi
}
function stop_sysinv {
if is_service_enabled sysinv-api; then
stop_sysinv_api
fi
if is_service_enabled sysinv-cond; then
stop_sysinv_conductor
fi
if is_service_enabled sysinv-agent; then
stop_sysinv_agent
fi
}
function stop_sysinv_agent {
stop_process sysinv-agent
}
function stop_sysinv_api {
stop_process sysinv-api
}
function stop_sysinv_conductor {
stop_process sysinv-cond
}
$_XTRACE_STX_CONFIG

360
devstack/lib/stx-fault Normal file
View File

@ -0,0 +1,360 @@
#!/bin/bash
#
# lib/stx-fault
# Functions to control the configuration and operation of the **fault** service
# Dependencies:
#
# - The stx-update plugin must be enabled
# ``stack.sh`` calls the entry points in this order:
#
# - install_fault
# - configure_fault
# - init_fault
# - start_fault
# - stop_fault
# - cleanup_fault
_XTRACE_STX_FAULT=$(set +o | grep xtrace)
set -o xtrace
# Defaults
# --------
STX_FAULT_DIR=${GITDIR[$STX_FAULT_NAME]}
STX_FAULT_CONF_DIR=/etc/fm
FM_RESTAPI_CONF=$STX_FAULT_CONF_DIR/fm.conf
FM_RESTAPI_PASTE_INI=$STX_FAULT_CONF_DIR/api-paste.ini
FM_RESTAPI_AUTH_CACHE_DIR=${FM_RESTAPI_AUTH_CACHE_DIR:-/var/cache/fault}
FM_RESTAPI_DIR=$STX_FAULT_DIR/fm-rest-api/fm
if is_service_enabled tls-proxy; then
FM_RESTAPI_SERVICE_PROTOCOL="https"
fi
FM_RESTAPI_SERVICE_PROTOCOL=${FM_RESTAPI_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
FM_RESTAPI_SERVICE_HOST=${FM_RESTAPI_SERVICE_HOST:-$SERVICE_HOST}
FM_RESTAPI_SERVICE_PORT=${FM_RESTAPI_SERVICE_PORT:-18002}
FM_RESTAPI_WORKERS=${FM_RESTAPI_WORKERS:-4}
# STX_INST_DIR should be a non-root-writable place to install build artifacts
STX_INST_DIR=${STX_INST_DIR:-/usr/local}
STX_BIN_DIR=${STX_BIN_DIR:-$STX_INST_DIR/bin}
STX_SBIN_DIR=${STX_SBIN_DIR:-$STX_INST_DIR/sbin}
# Set up so we don't use sudo for installs when not necessary
STX_SUDO="sudo"
[[ -w $STX_INST_DIR ]] && STX_SUDO="env"
PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
# Functions
# ---------
function build_fm_common {
pushd $STX_FAULT_DIR/fm-common/sources
local major minor version x
if [[ -z $1 || -z $2 ]]; then
# get fm-common version
read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-common/PKG-INFO)
major=${version%%.*}
minor=${version##*.}
else
major=$1
minor=$2
fi
# build
make MAJOR=$major MINOR=$minor
python setup.py build
popd
}
function build_fm_mgr {
pushd $STX_FAULT_DIR/fm-mgr/sources
local x version
local major minor version x
if [[ -z $1 || -z $2 ]]; then
# get fm-mgr version
read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-mgr/PKG-INFO)
local major=${version%%.*}
local minor=${version##*.}
else
major=$1
minor=$2
fi
# build
CPATH=$STX_INST_DIR/include LIBRARY_PATH=$STX_INST_DIR/lib make \
MAJOR=$major \
MINOR=$minor
popd
}
function cleanup_fault {
stop_fault
if is_service_enabled fm-mgr; then
cleanup_fm_mgr
fi
if is_service_enabled fm-common; then
cleanup_fm_common
fi
if is_service_enabled fm-rest-api; then
cleanup_fm_rest_api
fi
}
function cleanup_fm_common {
local x version
# get fm-common version
read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-common/PKG-INFO)
local major=${version%%.*}
local minor=${version##*.}
sudo rm /etc/ld.so.conf.d/stx-fault.conf
pushd $STX_FAULT_DIR/fm-common/sources
$STX_SUDO make \
DESTDIR=$STX_INST_DIR \
BINDIR=/bin \
LIBDIR=/lib \
INCDIR=/include \
MAJOR=$major \
MINOR=$minor \
clean
$STX_SUDO rm $STX_BIN_DIR/fm_db_sync_event_suppression.py \
$STX_INST_DIR/include/fmConfig.h \
$STX_INST_DIR/include/fmLog.h
popd
}
function cleanup_fm_mgr {
local x version
# get fm-mgr version
read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-mgr/PKG-INFO)
local major=${version%%.*}
local minor=${version##*.}
pushd $STX_FAULT_DIR/fm-mgr/sources
$STX_SUDO make \
DESTDIR=$STX_INST_DIR \
BINDIR=/bin \
MAJOR=$major \
MINOR=$minor \
clean
popd
}
function cleanup_fm_rest_api {
sudo rm -rf $FM_RESTAPI_AUTH_CACHE_DIR $FM_RESTAPI_CONF
}
function configure_fault {
if is_service_enabled fm-rest-api; then
configure_fm_rest_api
create_fault_user_group
create_fault_accounts
fi
}
function configure_fm_rest_api {
sudo install -d -o $STACK_USER -m 755 $STX_FAULT_CONF_DIR
cp -p $STX_FAULT_DIR/devstack/files/api-paste.ini $FM_RESTAPI_PASTE_INI
configure_auth_token_middleware $FM_RESTAPI_CONF fm $FM_RESTAPI_AUTH_CACHE_DIR
iniset $FM_RESTAPI_CONF database connection $(database_connection_url fm)
iniset $FM_RESTAPI_CONF api api_paste_config $FM_RESTAPI_PASTE_INI
iniset $FM_RESTAPI_CONF api api_workers $FM_RESTAPI_WORKERS
iniset $FM_RESTAPI_CONF api bind_host $FM_RESTAPI_SERVICE_HOST
iniset $FM_RESTAPI_CONF api bind_port $FM_RESTAPI_SERVICE_PORT
iniset $FM_RESTAPI_CONF oslo_middleware enable_proxy_headers_parsing True
if [ "$SYSLOG" != "False" ]; then
iniset $FM_RESTAPI_CONF DEFAULT use_syslog True
# stx specific?
iniset $FM_RESTAPI_CONF DEFAULT syslog_log_facility local2
fi
# Additional things set in stx config
iniset $FM_RESTAPI_CONF DEFAULT region_name RegionOne
iniset $FM_RESTAPI_CONF DEFAULT event_log_max_size 4000
iniset $FM_RESTAPI_CONF DEFAULT system_name $(hostname)
iniset $FM_RESTAPI_CONF database idle_timeout 60
iniset $FM_RESTAPI_CONF database max_pool_size 1
iniset $FM_RESTAPI_CONF database max_overflow 20
iniset $FM_RESTAPI_CONF keystone_authtoken region_name RegionOne
# sysinv settings to move there...
iniset $FM_RESTAPI_CONF sysinv catalog_info platform:sysinv:internalURL
iniset $FM_RESTAPI_CONF sysinv os_region_name RegionOne
}
function create_fault_accounts {
create_service_user "fm"
get_or_create_service "fm" "faultmanagement" "Fault Management Service"
get_or_create_endpoint \
"faultmanagement" \
"$REGION_NAME" \
"$FM_RESTAPI_SERVICE_PROTOCOL://$FM_RESTAPI_SERVICE_HOST:$FM_RESTAPI_SERVICE_PORT/v1"
}
function create_fault_cache_dir {
# Create cache dir
sudo install -d -o $STACK_USER $FM_RESTAPI_AUTH_CACHE_DIR
rm -f $FM_RESTAPI_AUTH_CACHE_DIR/*
}
function create_fault_user_group {
:
}
function init_fault {
create_fault_cache_dir
}
function install_fault {
if is_service_enabled fm-common; then
install_fm_common
fi
if is_service_enabled fm-client || is_service_enabled fm-common; then
install_fm_client
fi
if is_service_enabled fm-api; then
install_fm_api
fi
if is_service_enabled fm-mgr; then
install_fm_mgr
fi
if is_service_enabled fm-rest-api && is_service_enabled stx-config; then
install_fm_rest_api
fi
}
function install_fm_api {
pushd $STX_FAULT_DIR/fm-api
sudo python setup.py install \
--root=/ \
--install-lib=$PYTHON_SITE_DIR \
--prefix=/usr \
--install-data=/usr/share \
--single-version-externally-managed
popd
}
function install_fm_client {
pushd $STX_FAULT_DIR/python-fmclient/fmclient
sudo python setup.py install \
--root=/ \
--install-lib=$PYTHON_SITE_DIR \
--prefix=/usr \
--install-data=/usr/share \
--single-version-externally-managed
popd
}
function install_fm_common {
pushd $STX_FAULT_DIR/fm-common/sources
local major minor version x
# get fm-common version
read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-common/PKG-INFO)
major=${version%%.*}
minor=${version##*.}
build_fm_common $major $minor
# install to STX_INST_DIR
# Note that DESTDIR prefixes the other locations in the Makefile
$STX_SUDO make \
DESTDIR=$STX_INST_DIR \
BINDIR=/bin \
LIBDIR=/lib \
INCDIR=/include \
MAJOR=$major \
MINOR=$minor \
install
sudo python setup.py install \
--root=/ \
--install-lib=$PYTHON_SITE_DIR \
--prefix=/usr \
--install-data=/usr/share \
# This _is_ still a little nasty, clean it up
$STX_SUDO install -m 755 fm_db_sync_event_suppression.py \
$STX_BIN_DIR/fm_db_sync_event_suppression.py
# install the headers that used by fm-mgr package
$STX_SUDO install -m 644 -p -D fmConfig.h $STX_INST_DIR/include/fmConfig.h
$STX_SUDO install -m 644 -p -D fmLog.h $STX_INST_DIR/include/fmLog.h
# Make sure we can find it later
# TODO: this should be managed better
echo $STX_INST_DIR/lib | sudo tee /etc/ld.so.conf.d/stx-fault.conf
sudo ldconfig
popd
}
function install_fm_mgr {
pushd $STX_FAULT_DIR/fm-mgr/sources
local major minor version x
# get fm-mgr version
read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-mgr/PKG-INFO)
major=${version%%.*}
minor=${version##*.}
build_fm_mgr $major $minor
# install to STX_INST_DIR
# Note that DESTDIR prefixes the other locations in the Makefile
$STX_SUDO make \
DESTDIR=$STX_INST_DIR \
BINDIR=/bin \
MAJOR=$major \
MINOR=$minor \
install
popd
}
function install_fm_rest_api {
setup_develop $FM_RESTAPI_DIR
}
function start_fault {
if is_service_enabled fm-rest-api; then
run_process fm-api "$STX_BIN_DIR/fm-api --config-file $FM_RESTAPI_CONF"
fi
}
function stop_fault {
if is_service_enabled fm-rest-api; then
stop_process fm_api
fi
}
$_XTRACE_STX_FAULT

978
devstack/lib/stx-metal Normal file
View File

@ -0,0 +1,978 @@
#!/bin/bash
#
# lib/stx-metal
# Functions to control the configuration and operation of stx-metal
#
# To add a new maintenance service, the following functions should be
# added/modified.
#
# install_maintenance Build and install maintenance services regardless
# node personality. The services within this function
# will be installed on each node.
#
# install_mtce_{personality}
# Per personality build and install services on
# specific node. A new kind of personality installation
# function has to be added under 'install' of plugin.sh.
#
# configure_maintenance Add configuration for services, if a config file
# template is needed, add it to devstack/files/
# AIO-SX supported only for current configuration.
#
# start_{service_name} The service start function, add to start_maintenance
# if the service is running on each node, or to
# start_mtce_{personality} if the service is running on one
# node per personality.
# Make sure the service is enabled in devstack when testing,
# otherwise run_process will return immediately.
#
# stop_{service_name} Stop the service when unstack.sh is processed. Called by
# stop_maintenance or stop_mtce_{personality}.
#
# cleanup_metal Remove the service files installed.
_XTRACE_STX_METAL=$(set +o | grep xtrace)
set -o xtrace
# Defaults
# --------
STX_METAL_DIR=${GITDIR[$STX_METAL_NAME]}
# STX_INST_DIR should be a non-root-writable place to install build artifacts
STX_INST_DIR=${STX_INST_DIR:-$DEST/usr}
SYSCONFDIR=/etc
OAM_ETH_NAME=ens3
MGMT_ETH_NAME=lo
SW_VERSION=18.10
OCF_ROOT=/usr/lib/ocf
# Functions
# ---------
function build_mtce {
pushd ${STX_METAL_DIR}/mtce/src
local major minor version x
if [[ -z $1 || -z $2 ]]; then
# get mtce version
read x version <<< $(grep '^Version:' ${STX_METAL_DIR}/mtce/PKG-INFO)
major=${version%%.*}
minor=${version##*.}
else
major=$1
minor=$2
fi
# build
CPATH=$STX_INST_DIR/include LIBRARY_PATH=$STX_INST_DIR/lib make \
VER_MJR=${major} \
VER=${major}.${minor} \
CCFLAGS=' -g -O2 -Wall -Wextra -std=c++11 -DBUILDINFO="\"$$(date)\""' \
EXTRALDFLAGS="-L$STX_INST_DIR"/lib64 \
build
popd
}
function build_mtce_common {
pushd ${STX_METAL_DIR}/mtce-common/src
# build
CPATH=$STX_INST_DIR/include LIBRARY_PATH=$STX_INST_DIR/lib make \
CCFLAGS=' -g -O2 -Wall -Wextra -std=c++11 -DBUILDINFO="\"$$(date)\""' \
build
popd
}
function install_maintenance {
install_mtce_common
# components could be seperately installed if
# installation is well controlled in Makefile
install_mtce
if is_service_enabled mtce-compute; then
install_mtce_compute
fi
if is_service_enabled mtce-control; then
install_mtce_control
fi
if is_service_enabled mtce-storage; then
install_mtce_storage
fi
}
function install_mtce_common {
pushd ${STX_METAL_DIR}/mtce-common/src
local x version
# get mtce-common version
read x version <<< $(grep '^Version:' ${STX_METAL_DIR}/mtce-common/PKG-INFO)
local major=${version%%.*}
local minor=${version##*.}
build_mtce_common
local lib64_dir=${STX_INST_DIR}/lib64
local inc_dir=${STX_INST_DIR}/include
local inc_dir_common=${STX_INST_DIR}/include/mtce-common
local inc_dir_daemon=${STX_INST_DIR}/include/mtce-daemon
local libdaecom_file=( \
"common/libcommon.a" \
"common/libthreadUtil.a" \
"common/libipmiUtil.a" \
"common/libpingUtil.a" \
"common/libnodeBase.a" \
"common/libregexUtil.a" \
"common/libhostUtil.a" \
"daemon/libdaemon.a" \
)
install -m 755 -d ${lib64_dir}
install -m 644 -t ${lib64_dir} ${libdaecom_file[*]}
install -m 755 -d ${inc_dir}
local commonhdr_file=( \
"common/fitCodes.h" \
"common/logMacros.h" \
"common/returnCodes.h" \
"common/nodeTimers.h" \
"common/hostClass.h" \
"common/httpUtil.h" \
"common/jsonUtil.h" \
"common/msgClass.h" \
"common/nodeBase.h" \
"common/nodeEvent.h" \
"common/nodeMacro.h" \
"common/nodeUtil.h" \
"common/timeUtil.h" \
"common/alarmUtil.h" \
"common/hostUtil.h" \
"common/ipmiUtil.h" \
"common/nlEvent.h" \
"common/pingUtil.h" \
"common/regexUtil.h" \
"common/threadUtil.h" \
"common/tokenUtil.h" \
"common/secretUtil.h" \
)
install -m 755 -d ${inc_dir}
install -m 644 -t ${inc_dir} ${commonhdr_file[*]}
local daemonhdr_file=( \
"daemon/daemon_ini.h" \
"daemon/daemon_common.h" \
"daemon/daemon_option.h" \
)
install -m 755 -d ${inc_dir}
install -m 644 -t ${inc_dir} ${daemonhdr_file[*]}
popd
}
function install_mtce_compute {
local sysconf_dir=${SYSCONFDIR}
local unit_dir=${SYSCONFDIR}/systemd/system
local local_etc_pmond=${SYSCONFDIR}/pmon.d
local local_etc_goenabledd=${SYSCONFDIR}/goenabled.d
local local_etc_nova=${SYSCONFDIR}/nova
# install
pushd ${STX_METAL_DIR}/mtce-compute/src
# Worker-Only Init Scripts
sudo install -m 755 -p -D scripts/goenabled ${sysconf_dir}/init.d/goenabledWorker
sudo install -m 755 -p -D scripts/e_nova-init ${sysconf_dir}/init.d/e_nova-init
sudo install -m 755 -p -D scripts/nova-cleanup ${sysconf_dir}/init.d/nova-cleanup
sudo install -m 755 -p -D scripts/nova-startup ${sysconf_dir}/init.d/nova-startup
# Worker-Only Process Monitor Config files
sudo install -m 755 -d ${local_etc_pmond}
sudo install -m 755 -d ${local_etc_nova}
sudo install -m 644 -p -D scripts/nova-cleanup.conf ${local_etc_nova}/nova-cleanup.conf
sudo install -m 644 -p -D scripts/nova-compute.conf ${local_etc_nova}/nova-compute.conf
sudo install -m 644 -p -D scripts/libvirtd.conf ${local_etc_pmond}/libvirtd.conf
# Worker-Only Go Enabled Test
sudo install -m 755 -d ${local_etc_goenabledd}
sudo install -m 755 -p -D scripts/nova-goenabled.sh ${local_etc_goenabledd}/nova-goenabled.sh
sudo install -m 755 -p -D scripts/virt-support-goenabled.sh ${local_etc_goenabledd}/virt-support-goenabled.sh
# Install to systemd
sudo install -m 644 -p -D scripts/e_nova-init.service ${unit_dir}/devstack@e_nova-init.service
popd
}
function install_mtce_control {
local sysconf_dir=${SYSCONFDIR}
local unit_dir=${SYSCONFDIR}/systemd/system
local local_etc_pmond=${SYSCONFDIR}/pmon.d
local local_etc_goenabledd=${SYSCONFDIR}/goenabled.d
# install
pushd ${STX_METAL_DIR}/mtce-control/src
# Controller-Only Init Scripts
sudo install -m 755 -p -D scripts/goenabled ${sysconf_dir}/init.d/goenabledControl
sudo install -m 755 -p -D scripts/hbsAgent ${sysconf_dir}/init.d/hbsAgent
# Controller-Only Process Monitor Config files
sudo install -m 755 -d ${local_etc_pmond}
sudo install -m 644 -p -D scripts/hbsAgent.conf ${local_etc_pmond}/hbsAgent.conf
# Controller-Only Heartbeat Service file
sudo install -m 644 -p -D scripts/hbsAgent.service ${unit_dir}/devstack@hbsAgent.service
# Controller-Only Go Enabled Test
sudo install -m 755 -d ${local_etc_goenabledd}
popd
}
function install_mtce_storage {
local sysconf_dir=${SYSCONFDIR}
local unit_dir=${SYSCONFDIR}/systemd/system
local local_etc_pmond=${SYSCONFDIR}/pmon.d
local local_etc_goenabledd=${SYSCONFDIR}/goenabled.d
local local_etc_servicesd=${SYSCONFDIR}/services.d
# install
pushd ${STX_METAL_DIR}/mtce-storage/src
# Storage-Only Init Scripts
sudo install -m 755 -p -D scripts/goenabled ${sysconf_dir}/init.d/goenabledStorage
# Storage-Only Process Monitor Config files
sudo install -m 755 -d ${local_etc_pmond}
# Storage-Only Go Enabled Tests
sudo install -m 755 -d ${local_etc_goenabledd}
# Storage-Only Services
sudo install -m 755 -d ${local_etc_servicesd}/storage
popd
}
function install_mtce {
pushd ${STX_METAL_DIR}/mtce/src
local x version
# get mtce version
read x version <<< $(grep '^Version:' ${STX_METAL_DIR}/mtce/PKG-INFO)
local major=${version%%.*}
local minor=${version##*.}
build_mtce $major $minor
local bin_dir=/usr/local/bin
local sbin_dir=/usr/local/sbin
local lib_dir=${STX_INST_DIR}/lib
local lib64_dir=${STX_INST_DIR}/lib64
local inc_dir=${STX_INST_DIR}/include
local sysconf_dir=${SYSCONFDIR}
local unit_dir=${SYSCONFDIR}/systemd/system
local local_etc_pmond=${sysconf_dir}/pmon.d
local local_etc_rmond=${sysconf_dir}/rmon.d
local local_etc_goenabledd=${sysconf_dir}/goenabled.d
local local_etc_servicesd=${sysconf_dir}/services.d
local local_etc_logrotated=${sysconf_dir}/logrotate.d
# install
if [ ! -d "/etc/rc.d" ]; then
sudo mkdir -p /etc/rc.d
fi
sudo ln -sf /etc/init.d /etc/rc.d/init.d
# TODO: follow install_files way in install_mtce_common to install files
# Resource Agent Stuff
sudo install -m 755 -d ${OCF_ROOT}/resource.d/platform
sudo install -m 755 -p -D scripts/mtcAgent ${OCF_ROOT}/resource.d/platform/mtcAgent
sudo install -m 755 -p -D hwmon/scripts/ocf/hwmon ${OCF_ROOT}/resource.d/platform/hwmon
# TODO: fix this issue in multi-os task
# The default shell of ubuntu is dash, causes loop syntax error
if is_ubuntu; then
sudo sed -i "s|#!/bin/sh|#!/bin/bash|g" ${OCF_ROOT}/resource.d/platform/mtcAgent
sudo sed -i "s|#!/bin/sh|#!/bin/bash|g" ${OCF_ROOT}/resource.d/platform/hwmon
fi
# TODO: figure out why OCF_ROOT is not set when running stack.sh
# workaround to hardcode OCF_ROOT
# sed -i "s|\${OCF_ROOT}|\${OCF_ROOT}|g" ${OCF_ROOT}/resource.d/platform/mtcAgent
# sed -i "s|\${OCF_ROOT}|\${OCF_ROOT}|g" ${OCF_ROOT}/resource.d/platform/hwmon
# config files
sudo install -m 755 -d ${sysconf_dir}/mtc
sudo install -m 644 -p -D scripts/mtc.ini ${sysconf_dir}/mtc.ini
sudo install -m 644 -p -D scripts/mtc.conf ${sysconf_dir}/mtc.conf
sudo install -m 644 -p -D fsmon/scripts/fsmond.conf ${sysconf_dir}/mtc/fsmond.conf
sudo install -m 644 -p -D hwmon/scripts/hwmond.conf ${sysconf_dir}/mtc/hwmond.conf
sudo install -m 644 -p -D pmon/scripts/pmond.conf ${sysconf_dir}/mtc/pmond.conf
sudo install -m 644 -p -D rmon/scripts/rmond.conf ${sysconf_dir}/mtc/rmond.conf
sudo install -m 644 -p -D hostw/scripts/hostwd.conf ${sysconf_dir}/mtc/hostwd.conf
sudo install -m 755 -d ${sysconf_dir}/bmc/server_profiles.d
sudo install -m 644 -p -D scripts/sensor_hp360_v1_ilo_v4.profile ${sysconf_dir}/bmc/server_profiles.d/sensor_hp360_v1_ilo_v4.profile
sudo install -m 644 -p -D scripts/sensor_hp380_v1_ilo_v4.profile ${sysconf_dir}/bmc/server_profiles.d/sensor_hp380_v1_ilo_v4.profile
sudo install -m 644 -p -D scripts/sensor_quanta_v1_ilo_v4.profile ${sysconf_dir}/bmc/server_profiles.d/sensor_quanta_v1_ilo_v4.profile
# binaries
sudo install -m 755 -p -D maintenance/mtcAgent ${bin_dir}/mtcAgent
sudo install -m 755 -p -D maintenance/mtcClient ${bin_dir}/mtcClient
sudo install -m 755 -p -D heartbeat/hbsAgent ${bin_dir}/hbsAgent
sudo install -m 755 -p -D heartbeat/hbsClient ${bin_dir}/hbsClient
sudo install -m 755 -p -D pmon/pmond ${bin_dir}/pmond
sudo install -m 755 -p -D hostw/hostwd ${bin_dir}/hostwd
sudo install -m 755 -p -D rmon/rmond ${bin_dir}/rmond
sudo install -m 755 -p -D fsmon/fsmond ${bin_dir}/fsmond
sudo install -m 755 -p -D hwmon/hwmond ${bin_dir}/hwmond
sudo install -m 755 -p -D mtclog/mtclogd ${bin_dir}/mtclogd
sudo install -m 755 -p -D alarm/mtcalarmd ${bin_dir}/mtcalarmd
sudo install -m 755 -p -D rmon/rmon_resource_notify/rmon_resource_notify ${bin_dir}/rmon_resource_notify
sudo install -m 755 -p -D scripts/wipedisk ${bin_dir}/wipedisk
sudo install -m 755 -p -D fsync/fsync ${STX_INST_DIR}/sbin/fsync
sudo install -m 700 -p -D pmon/scripts/pmon-restart ${sbin_dir}/pmon-restart
sudo install -m 700 -p -D pmon/scripts/pmon-start ${sbin_dir}/pmon-start
sudo install -m 700 -p -D pmon/scripts/pmon-stop ${sbin_dir}/pmon-stop
# init script files
sudo install -m 755 -p -D scripts/mtcClient ${sysconf_dir}/init.d/mtcClient
sudo install -m 755 -p -D scripts/hbsClient ${sysconf_dir}/init.d/hbsClient
sudo install -m 755 -p -D hwmon/scripts/lsb/hwmon ${sysconf_dir}/init.d/hwmon
sudo install -m 755 -p -D fsmon/scripts/fsmon ${sysconf_dir}/init.d/fsmon
sudo install -m 755 -p -D scripts/mtclog ${sysconf_dir}/init.d/mtclog
sudo install -m 755 -p -D pmon/scripts/pmon ${sysconf_dir}/init.d/pmon
sudo install -m 755 -p -D rmon/scripts/rmon ${sysconf_dir}/init.d/rmon
sudo install -m 755 -p -D hostw/scripts/hostw ${sysconf_dir}/init.d/hostw
sudo install -m 755 -p -D alarm/scripts/mtcalarm.init ${sysconf_dir}/init.d/mtcalarm
sudo install -m 755 -p -D scripts/config ${sysconf_dir}/init.d/config
sudo install -m 755 -p -D scripts/hwclock.sh ${sysconf_dir}/init.d/hwclock.sh
sudo install -m 644 -p -D scripts/hwclock.service ${unit_dir}/devstack@hwclock.service
# systemd service files
sudo install -m 644 -p -D fsmon/scripts/fsmon.service ${unit_dir}/devstack@fsmon.service
sudo install -m 644 -p -D hwmon/scripts/hwmon.service ${unit_dir}/devstack@hwmon.service
sudo install -m 644 -p -D rmon/scripts/rmon.service ${unit_dir}/devstack@rmon.service
sudo install -m 644 -p -D pmon/scripts/pmon.service ${unit_dir}/devstack@pmon.service
sudo install -m 644 -p -D hostw/scripts/hostw.service ${unit_dir}/devstack@hostw.service
sudo install -m 644 -p -D scripts/mtcClient.service ${unit_dir}/devstack@mtcClient.service
sudo install -m 644 -p -D scripts/hbsClient.service ${unit_dir}/devstack@hbsClient.service
sudo install -m 644 -p -D scripts/mtclog.service ${unit_dir}/devstack@mtclog.service
sudo install -m 644 -p -D scripts/goenabled.service ${unit_dir}/devstack@goenabled.service
sudo install -m 644 -p -D scripts/runservices.service ${unit_dir}/devstack@runservices.service
sudo install -m 644 -p -D alarm/scripts/mtcalarm.service ${unit_dir}/devstack@mtcalarm.service
# go enabled stuff
sudo install -m 755 -d ${local_etc_goenabledd}
sudo install -m 755 -p -D scripts/goenabled ${sysconf_dir}/init.d/goenabled
# start or stop services test script
sudo install -m 755 -d ${local_etc_servicesd}/controller
sudo install -m 755 -d ${local_etc_servicesd}/storage
sudo install -m 755 -d ${local_etc_servicesd}/worker
sudo install -m 755 -p -D scripts/mtcTest ${local_etc_servicesd}/controller
sudo install -m 755 -p -D scripts/mtcTest ${local_etc_servicesd}/storage
sudo install -m 755 -p -D scripts/mtcTest ${local_etc_servicesd}/worker
sudo install -m 755 -p -D scripts/runservices ${sysconf_dir}/init.d/runservices
# test tools
sudo install -m 755 -p -D scripts/dmemchk.sh ${sbin_dir}
# process monitor config files
sudo install -m 755 -d ${local_etc_pmond}
sudo install -m 644 -p -D scripts/mtcClient.conf ${local_etc_pmond}/mtcClient.conf
sudo install -m 644 -p -D scripts/hbsClient.conf ${local_etc_pmond}/hbsClient.conf
sudo install -m 644 -p -D pmon/scripts/acpid.conf ${local_etc_pmond}/acpid.conf
sudo install -m 644 -p -D pmon/scripts/sshd.conf ${local_etc_pmond}/sshd.conf
sudo install -m 644 -p -D pmon/scripts/syslog-ng.conf ${local_etc_pmond}/syslog-ng.conf
sudo install -m 644 -p -D pmon/scripts/nslcd.conf ${local_etc_pmond}/nslcd.conf
sudo install -m 644 -p -D rmon/scripts/rmon.conf ${local_etc_pmond}/rmon.conf
sudo install -m 644 -p -D fsmon/scripts/fsmon.conf ${local_etc_pmond}/fsmon.conf
sudo install -m 644 -p -D scripts/mtclogd.conf ${local_etc_pmond}/mtclogd.conf
sudo install -m 644 -p -D alarm/scripts/mtcalarm.pmon.conf ${local_etc_pmond}/mtcalarm.conf
# resource monitor config files
sudo install -m 755 -d ${local_etc_rmond}
sudo install -m 755 -d ${sysconf_dir}/rmonapi.d
sudo install -m 755 -d ${sysconf_dir}/rmonfiles.d
sudo install -m 755 -d ${sysconf_dir}/rmon_interfaces.d
sudo install -m 644 -p -D rmon/scripts/remotelogging_resource.conf ${local_etc_rmond}/remotelogging_resource.conf
sudo install -m 644 -p -D rmon/scripts/cinder_virtual_resource.conf ${local_etc_rmond}/cinder_virtual_resource.conf
sudo install -m 644 -p -D rmon/scripts/nova_virtual_resource.conf ${local_etc_rmond}/nova_virtual_resource.conf
sudo install -m 644 -p -D rmon/scripts/oam_resource.conf ${sysconf_dir}/rmon_interfaces.d/oam_resource.conf
sudo install -m 644 -p -D rmon/scripts/management_resource.conf ${sysconf_dir}/rmon_interfaces.d/management_resource.conf
sudo install -m 644 -p -D rmon/scripts/infrastructure_resource.conf ${sysconf_dir}/rmon_interfaces.d/infrastructure_resource.conf
# sudo install -m 755 -p -D rmon/scripts/query_ntp_servers.sh ${sysconf_dir}/rmonfiles.d/query_ntp_servers.sh
sudo install -m 755 -p -D rmon/scripts/rmon_reload_on_cpe.sh ${local_etc_goenabledd}/rmon_reload_on_cpe.sh
# log rotation
sudo install -m 755 -d ${local_etc_logrotated}
sudo install -m 644 -p -D scripts/mtce.logrotate ${local_etc_logrotated}/mtce.logrotate
sudo install -m 644 -p -D hostw/scripts/hostw.logrotate ${local_etc_logrotated}/hostw.logrotate
sudo install -m 644 -p -D pmon/scripts/pmon.logrotate ${local_etc_logrotated}/pmon.logrotate
sudo install -m 644 -p -D rmon/scripts/rmon.logrotate ${local_etc_logrotated}/rmon.logrotate
sudo install -m 644 -p -D fsmon/scripts/fsmon.logrotate ${local_etc_logrotated}/fsmon.logrotate
sudo install -m 644 -p -D hwmon/scripts/hwmon.logrotate ${local_etc_logrotated}/hwmon.logrotate
sudo install -m 644 -p -D alarm/scripts/mtcalarm.logrotate ${local_etc_logrotated}/mtcalarm.logrotate
# software development files
install -m 644 -p -D heartbeat/mtceHbsCluster.h ${inc_dir}/mtceHbsCluster.h
install -m 755 -p -D public/libamon.so.${major} ${lib64_dir}/libamon.so.${major}
install -m 755 -p -D rmon/rmonApi/librmonapi.so.${major} ${lib64_dir}/librmonapi.so.${major}
popd
pushd ${lib64_dir}
ln -sf libamon.so.${major} libamon.so.${major}.${minor}
ln -sf libamon.so.${major} libamon.so
ln -sf librmonapi.so.${major} librmonapi.so.${major}.${minor}
ln -sf librmonapi.so.${major} librmonapi.so
popd
}
function configure_maintenance {
echo "${STX_INST_DIR}/lib64" | sudo tee /etc/ld.so.conf.d/stx-metal.conf
sudo ldconfig
sudo mkdir -p /etc/platform
sudo cp -p ${GITDIR["$STX_METAL_NAME"]}/devstack/files/platform.conf /etc/platform/
# TODO: implement other configuration
# All-in-one simplex config
if is_service_enabled mtce-control -a is_service_enabled mtce-compute \
-a is_service_enabled mtce-storage; then
sudo sed -i "s|@SUBFUNCTION@|controller,worker,storage|g" /etc/platform/platform.conf
sudo sed -i "s|@SYS_TYPE@|All-in-one|g" /etc/platform/platform.conf
sudo sed -i "s|@SYS_MODE@|simplex|g" /etc/platform/platform.conf
sudo sed -i "s|@SW_VERSION@|${SW_VERSION}|g" /etc/platform/platform.conf
sudo sed -i "s|@MGMT_ETH@|${MGMT_ETH_NAME}|g" /etc/platform/platform.conf
sudo sed -i "s|@OAM_ETH@|${OAM_ETH_NAME}|g" /etc/platform/platform.conf
fi
# TODO: enable controllerconfig to do this
# add floating ip hostname in hosts
if ! grep -q 'controller$' /etc/hosts; then
echo "192.168.204.2 controller" | sudo tee -a /etc/hosts
fi
# add controller-0
if ! grep -q 'controller-0$' /etc/hosts; then
echo "192.168.204.3 controller-0" | sudo tee -a /etc/hosts
fi
# puppet configuration for mtce
iniset -sudo /etc/mtc.ini "agent" "keystone_auth_username" "admin"
iniset -sudo /etc/mtc.ini "agent" "keystone_auth_pw" "secret"
iniset -sudo /etc/mtc.ini "agent" "keystone_auth_project" "admin"
iniset -sudo /etc/mtc.ini "agent" "keystone_user_domain" "Default"
iniset -sudo /etc/mtc.ini "agent" "keystone_project_domain" "Default"
iniset -sudo /etc/mtc.ini "agent" "keystone_auth_host" "127.0.0.1"
iniset -sudo /etc/mtc.ini "agent" "keystone_auth_uri" "http://127.0.0.1:5000"
iniset -sudo /etc/mtc.ini "agent" "keystone_auth_port" "5000"
iniset -sudo /etc/mtc.ini "agent" "keystone_region_name" "RegionOne"
iniset -sudo /etc/mtc.ini "agent" "keyring_directory" "/opt/platform/.keyring/${SW_VERSION}"
# sm port add to config file
iniset -sudo /etc/mtc.ini "agent" "sm_server_port" "2124"
iniset -sudo /etc/mtc.ini "agent" "sm_client_port" "2224"
# TODO(dtroyer): Do this with the devstack functions in lib/apache
# # add port 5000 to keystone apache server
# sudo sed -i '$aListen 5000' /etc/apache2/sites-available/keystone-wsgi-public.conf
# sudo sed -i '$a<VirtualHost *:5000>' /etc/apache2/sites-available/keystone-wsgi-public.conf
# sudo sed -i '$aProxyPass / "unix:/var/run/uwsgi/keystone-wsgi-public.socket|uwsgi://uwsgi-uds-keystone-wsgi-public/" retry=0"' /etc/apache2/sites-available/keystone-wsgi-public.conf
# sudo sed -i '$a</VirtualHost>' /etc/apache2/sites-available/keystone-wsgi-public.conf
# sudo systemctl restart apache2
if is_ubuntu; then
sudo ln -sf /lib/lsb/init-functions /etc/init.d/functions
fi
}
function start_mtcAgent {
# add admin compute endpoint
if is_service_enabled nova; then
source openrc admin admin
openstack endpoint create --region RegionOne compute admin http://172.28.0.79/compute/v2.1
fi
# init mtcAgent
iniset -sudo /etc/systemd/system/devstack@mtcAgent.service "Service" "Type" "forking"
iniset -sudo /etc/systemd/system/devstack@mtcAgent.service "Service" "PIDFile" "/var/run/mtcAgent.pid"
iniset -sudo /etc/systemd/system/devstack@mtcAgent.service "Service" "Environment" "OCF_ROOT=${OCF_ROOT}"
sudo sed -i "s|OCF_RESKEY_state_default=\"standby\"|OCF_RESKEY_state_default=\"active\"|g" \
${OCF_ROOT}/resource.d/platform/mtcAgent
run_process mtcAgent "${OCF_ROOT}/resource.d/platform/mtcAgent start" root root
}
function start_hbsAgent {
run_process hbsAgent "${SYSCONFDIR}/rc.d/init.d/hbsAgent start" root root
}
function start_hwmon {
# init hwmon
iniset -sudo /etc/systemd/system/devstack@hwmon.service "Service" "Type" "forking"
iniset -sudo /etc/systemd/system/devstack@hwmon.service "Service" "PIDFile" "/var/run/hwmond.pid"
run_process hwmon "${OCF_ROOT}/resource.d/platform/hwmon start" root root
}
function start_mtce_control {
# Oneshot goenabled control
sudo ${SYSCONFDIR}/init.d/goenabledControl start
if is_service_enabled mtce-agent || is_service_enabled mtce; then
start_mtcAgent
fi
if is_service_enabled hbs-agent || is_service_enabled hbs; then
start_hbsAgent
fi
if is_service_enabled hwmon && is_service_enabled sysinv; then
start_hwmon
fi
}
function start_mtce_compute {
# Oneshot goenabled worker
sudo ${SYSCONFDIR}/init.d/goenabledWorker start
# TODO: It's not working until initial compute config applied by puppet
# implemented in devstack
# oneshot nova init service
#sudo cp ${STX_INST_DIR}/lib/systemd/system/e_nova-init.service \
# ${SYSCONFDIR}/systemd/system/devstack@e_nova-init.service
#run_process e_nova-init "${SYSCONFDIR}/init.d/e_nova-init start" root root
}
function start_mtce_storage {
# Oneshot goenabled storage
sudo ${SYSCONFDIR}/init.d/goenabledStorage start
}
function start_maintenance {
if is_service_enabled mtce-control; then
start_mtce_control
fi
if is_service_enabled mtce-compute; then
start_mtce_compute
fi
if is_service_enabled mtce-storage; then
start_mtce_storage
fi
start_goenabled
if is_service_enabled hbs; then
start_hbsClient
fi
if is_service_enabled mtce; then
start_mtcClient
fi
if is_service_enabled rmon; then
start_rmon
fi
if is_service_enabled mtclog; then
start_mtclog
fi
if is_service_enabled mtcalarm; then
start_mtcalarm
fi
if is_service_enabled fsmon; then
start_fsmon
fi
if is_service_enabled pmon; then
start_pmon
fi
if is_service_enabled hostw; then
start_hostw
fi
}
function start_mtcClient {
run_process mtcClient "${SYSCONFDIR}/rc.d/init.d/mtcClient start" root root
}
function start_hbsClient {
run_process hbsClient "${SYSCONFDIR}/rc.d/init.d/hbsClient start" root root
}
function start_pmon {
run_process pmon "${SYSCONFDIR}/rc.d/init.d/pmon start" root root
}
function start_rmon {
run_process rmon "${SYSCONFDIR}/rc.d/init.d/rmon start" root root
}
function start_mtclog {
run_process mtclog "${SYSCONFDIR}/rc.d/init.d/mtclog start" root root
}
function start_mtcalarm {
run_process mtcalarm "${SYSCONFDIR}/rc.d/init.d/mtcalarm start" root root
}
function start_goenabled {
sudo ${SYSCONFDIR}/init.d/goenabled start
}
function start_fsmon {
run_process fsmon "${SYSCONFDIR}/rc.d/init.d/fsmon start" root root
}
function start_hostw {
run_process hostw "${SYSCONFDIR}/rc.d/init.d/hostw start" root root
}
function stop_mtcAgent {
stop_process mtcAgent
}
function stop_hbsAgent {
stop_process hbsAgent
}
function stop_hwmon {
stop_process hwmon
}
function stop_mtce_control {
sudo ${SYSCONFDIR}/init.d/goenabledControl stop
if is_service_enabled mtce-agent || is_service_enabled mtce; then
stop_mtcAgent
fi
if is_service_enabled hbs-agent || is_service_enabled hbs; then
stop_hbsAgent
fi
if is_service_enabled hwmon && is_service_enabled sysinv; then
stop_hwmon
fi
}
function stop_mtce_compute {
sudo ${SYSCONFDIR}/init.d/goenabledWorker stop
}
function stop_mtce_storage {
sudo ${SYSCONFDIR}/init.d/goenabledStorage stop
}
function stop_goenabled {
sudo ${SYSCONFDIR}/init.d/goenabled stop
}
function stop_pmon {
stop_process pmon
}
function stop_mtcClient {
stop_process mtcClient
}
function stop_hbsClient {
stop_process hbsClient
}
function stop_rmon {
stop_process rmon
}
function stop_mtclog {
stop_process mtclog
}
function stop_mtcalarm {
stop_process mtcalarm
}
function stop_fsmon {
stop_process fsmon
}
function stop_hostw {
stop_process hostw
}
function stop_maintenance {
stop_goenabled
if is_service_enabled pmon; then
stop_pmon
fi
if is_service_enabled mtce; then
stop_mtcClient
fi
if is_service_enabled hbs; then
stop_hbsClient
fi
if is_service_enabled rmon; then
stop_rmon
fi
if is_service_enabled mtclog; then
stop_mtclog
fi
if is_service_enabled mtcalarm; then
stop_mtcalarm
fi
if is_service_enabled fsmon; then
stop_fsmon
fi
if is_service_enabled hostw; then
stop_hostw
fi
if is_service_enabled mtce-control; then
stop_mtce_control
fi
if is_service_enabled mtce-compute; then
stop_mtce_compute
fi
if is_service_enabled mtce-storage; then
stop_mtce_storage
fi
}
function cleanup_metal {
# TODO: move it to Makefile uninstall
# remove mtce
local x version
# get mtce version
read x version <<< $(grep '^Version:' ${STX_METAL_DIR}/mtce/PKG-INFO)
local major=${version%%.*}
local minor=${version##*.}
local bin_dir=/usr/local/bin
local sbin_dir=/usr/local/sbin
local lib_dir=${STX_INST_DIR}/lib
local lib64_dir=${STX_INST_DIR}/lib64
local inc_dir=${STX_INST_DIR}/include
local sysconf_dir=${SYSCONFDIR}
local unit_dir=${SYSCONFDIR}/systemd/system
local local_etc_pmond=${sysconf_dir}/pmon.d
local local_etc_rmond=${sysconf_dir}/rmon.d
local local_etc_goenabledd=${sysconf_dir}/goenabled.d
local local_etc_servicesd=${sysconf_dir}/services.d
local local_etc_logrotated=${sysconf_dir}/logrotate.d
sudo rm -rf ${OCF_ROOT}/resource.d/platform/mtcAgent
sudo rm -rf ${OCF_ROOT}/resource.d/platform/hwmon
sudo rm -rf ${sysconf_dir}/mtc.ini
sudo rm -rf ${sysconf_dir}/mtc.conf
sudo rm -rf ${sysconf_dir}/mtc/fsmond.conf
sudo rm -rf ${sysconf_dir}/mtc/hwmond.conf
sudo rm -rf ${sysconf_dir}/mtc/pmond.conf
sudo rm -rf ${sysconf_dir}/mtc/rmond.conf
sudo rm -rf ${sysconf_dir}/mtc/hostwd.conf
sudo rm -rf ${sysconf_dir}/bmc/server_profiles.d/sensor_hp360_v1_ilo_v4.profile
sudo rm -rf ${sysconf_dir}/bmc/server_profiles.d/sensor_hp380_v1_ilo_v4.profile
sudo rm -rf ${sysconf_dir}/bmc/server_profiles.d/sensor_quanta_v1_ilo_v4.profile
# binaries
sudo rm -rf ${bin_dir}/mtcAgent
sudo rm -rf ${bin_dir}/mtcClient
sudo rm -rf ${bin_dir}/hbsAgent
sudo rm -rf ${bin_dir}/hbsClient
sudo rm -rf ${bin_dir}/pmond
sudo rm -rf ${bin_dir}/hostwd
sudo rm -rf ${bin_dir}/rmond
sudo rm -rf ${bin_dir}/fsmond
sudo rm -rf ${bin_dir}/hwmond
sudo rm -rf ${bin_dir}/mtclogd
sudo rm -rf ${bin_dir}/mtcalarmd
sudo rm -rf ${bin_dir}/rmon_resource_notify
sudo rm -rf ${bin_dir}/wipedisk
sudo rm -rf ${STX_INST_DIR}/sbin/fsync
sudo rm -rf ${sbin_dir}/pmon-restart
sudo rm -rf ${sbin_dir}/pmon-start
sudo rm -rf ${sbin_dir}/pmon-stop
# init script files
sudo rm -rf ${sysconf_dir}/init.d/mtcClient
sudo rm -rf ${sysconf_dir}/init.d/hbsClient
sudo rm -rf ${sysconf_dir}/init.d/hwmon
sudo rm -rf ${sysconf_dir}/init.d/fsmon
sudo rm -rf ${sysconf_dir}/init.d/mtclog
sudo rm -rf ${sysconf_dir}/init.d/pmon
sudo rm -rf ${sysconf_dir}/init.d/rmon
sudo rm -rf ${sysconf_dir}/init.d/hostw
sudo rm -rf ${sysconf_dir}/init.d/mtcalarm
sudo rm -rf ${sysconf_dir}/init.d/config
sudo rm -rf ${sysconf_dir}/init.d/hwclock.sh
sudo rm -rf ${unit_dir}/devstack@hwclock.service
# systemd service files
sudo rm -rf ${unit_dir}/devstack@fsmon.service
sudo rm -rf ${unit_dir}/devstack@hwmon.service
sudo rm -rf ${unit_dir}/devstack@rmon.service
sudo rm -rf ${unit_dir}/devstack@pmon.service
sudo rm -rf ${unit_dir}/devstack@hostw.service
sudo rm -rf ${unit_dir}/devstack@mtcClient.service
sudo rm -rf ${unit_dir}/devstack@hbsClient.service
sudo rm -rf ${unit_dir}/devstack@mtclog.service
sudo rm -rf ${unit_dir}/devstack@goenabled.service
sudo rm -rf ${unit_dir}/devstack@runservices.service
sudo rm -rf ${unit_dir}/devstack@mtcalarm.service
# go enabled stuff
sudo rm -rf ${sysconf_dir}/init.d/goenabled
# start or stop services test script
sudo rm -rf ${local_etc_servicesd}/worker
sudo rm -rf ${local_etc_servicesd}/controller
sudo rm -rf ${local_etc_servicesd}/storage
sudo rm -rf ${sysconf_dir}/init.d/runservices
# test tools
sudo rm -rf ${sbin_dir}/dmemchk.sh
# process monitor config files
sudo rm -rf ${local_etc_pmond}/mtcClient.conf
sudo rm -rf ${local_etc_pmond}/hbsClient.conf
sudo rm -rf ${local_etc_pmond}/acpid.conf
sudo rm -rf ${local_etc_pmond}/sshd.conf
sudo rm -rf ${local_etc_pmond}/syslog-ng.conf
sudo rm -rf ${local_etc_pmond}/nslcd.conf
sudo rm -rf ${local_etc_pmond}/rmon.conf
sudo rm -rf ${local_etc_pmond}/fsmon.conf
sudo rm -rf ${local_etc_pmond}/mtclogd.conf
sudo rm -rf ${local_etc_pmond}/mtcalarm.conf
# resource monitor config files
sudo rm -rf ${local_etc_rmond}/remotelogging_resource.conf
sudo rm -rf ${local_etc_rmond}/cinder_virtual_resource.conf
sudo rm -rf ${local_etc_rmond}/nova_virtual_resource.conf
sudo rm -rf ${sysconf_dir}/rmon_interfaces.d/oam_resource.conf
sudo rm -rf ${sysconf_dir}/rmon_interfaces.d/management_resource.conf
sudo rm -rf ${sysconf_dir}/rmon_interfaces.d/infrastructure_resource.conf
sudo rm -rf ${sysconf_dir}/rmonfiles.d/query_ntp_servers.sh
sudo rm -rf ${local_etc_goenabledd}/rmon_reload_on_cpe.sh
# log rotation
sudo rm -rf ${local_etc_logrotated}/mtce.logrotate
sudo rm -rf ${local_etc_logrotated}/hostw.logrotate
sudo rm -rf ${local_etc_logrotated}/pmon.logrotate
sudo rm -rf ${local_etc_logrotated}/rmon.logrotate
sudo rm -rf ${local_etc_logrotated}/fsmon.logrotate
sudo rm -rf ${local_etc_logrotated}/hwmon.logrotate
sudo rm -rf ${local_etc_logrotated}/mtcalarm.logrotate
# software development files
sudo rm -rf ${inc_dir}/mtceHbsCluster.h
sudo rm -rf ${lib64_dir}/libamon.so.${major}
sudo rm -rf ${lib64_dir}/librmonapi.so.${major}
sudo rm -rf ${lib64_dir}/libamon.so.${major}.${minor}
sudo rm -rf ${lib64_dir}/libamon.so
sudo rm -rf ${lib64_dir}/librmonapi.so.${major}.${minor}
sudo rm -rf ${lib64_dir}/librmonapi.so
#remove mtce_common
local inc_dir_common=${STX_INST_DIR}/include/mtce-common
local inc_dir_daemon=${STX_INST_DIR}/include/mtce-daemon
local libdaecom_file=( \
"libcommon.a" \
"libthreadUtil.a" \
"libipmiUtil.a" \
"libpingUtil.a" \
"libnodeBase.a" \
"libregexUtil.a" \
"libhostUtil.a" \
"libdaemon.a" \
)
uninstall_files ${lib64_dir} "${libdaecom_file[*]}"
local daecomhdr_file=( \
"fitCodes.h" \
"logMacros.h" \
"returnCodes.h" \
"nodeTimers.h" \
"hostClass.h" \
"httpUtil.h" \
"jsonUtil.h" \
"msgClass.h" \
"nodeBase.h" \
"nodeEvent.h" \
"nodeMacro.h" \
"nodeUtil.h" \
"timeUtil.h" \
"alarmUtil.h" \
"hostUtil.h" \
"ipmiUtil.h" \
"nlEvent.h" \
"pingUtil.h" \
"regexUtil.h" \
"threadUtil.h" \
"tokenUtil.h" \
"secretUtil.h" \
"daemon_ini.h" \
"daemon_common.h" \
"daemon_option.h" \
)
uninstall_files ${inc_dir_common} "${daecomhdr_file[*]}"
if is_service_enabled mtce-compute; then
local sysconf_dir=${SYSCONFDIR}
local unit_dir=${SYSCONFDIR}/systemd/system
local local_etc_pmond=${SYSCONFDIR}/pmon.d
local local_etc_goenabledd=${SYSCONFDIR}/goenabled.d
local local_etc_nova=${SYSCONFDIR}/nova
sudo rm -rf ${sysconf_dir}/init.d/goenabledWorker
sudo rm -rf ${sysconf_dir}/init.d/e_nova-init
sudo rm -rf ${sysconf_dir}/init.d/nova-cleanup
sudo rm -rf ${sysconf_dir}/init.d/nova-startup
# Worker-Only Process Monitor Config files
sudo rm -rf ${local_etc_nova}/nova-cleanup.conf
sudo rm -rf ${local_etc_nova}/nova-compute.conf
sudo rm -rf ${local_etc_pmond}/libvirtd.conf
# Worker-Only Go Enabled Test
sudo rm -rf ${local_etc_goenabledd}/nova-goenabled.sh
sudo rm -rf ${local_etc_goenabledd}/virt-support-goenabled.sh
# systemd
sudo rm -rf ${unit_dir}/devstack@e_nova-init.service
fi
if is_service_enabled mtce-control; then
local sysconf_dir=${SYSCONFDIR}
local unit_dir=${SYSCONFDIR}/systemd/system
local local_etc_pmond=${SYSCONFDIR}/pmon.d
local local_etc_goenabledd=${SYSCONFDIR}/goenabled.d
# Controller-Only Init Scripts
sudo rm -rf ${sysconf_dir}/init.d/goenabledControl
sudo rm -rf ${sysconf_dir}/init.d/hbsAgent
sudo rm -rf ${local_etc_pmond}/hbsAgent.conf
sudo rm -rf ${unit_dir}/devstack@hbsAgent.service
fi
if is_service_enabled mtce-storage; then
local sysconf_dir=${SYSCONFDIR}
local unit_dir=${SYSCONFDIR}/systemd/system
local local_etc_pmond=${SYSCONFDIR}/pmon.d
local local_etc_goenabledd=${SYSCONFDIR}/goenabled.d
local local_etc_servicesd=${SYSCONFDIR}/services.d
# Storage-Only Init Scripts
sudo rm -rf ${sysconf_dir}/init.d/goenabledStorage
fi
}
function uninstall_files {
local dest_dir=$1
local dest_file_array=($2)
local file=""
for (( i=0; i<${#dest_file_array[*]}; i++ )); do
file=${dest_file_array[$i]##*/}
sudo rm -rf $dest_dir/$file
done
}
$_XTRACE_STX_METAL

103
devstack/plugin.sh Normal file
View File

@ -0,0 +1,103 @@
#!/bin/bash
# devstack/plugin.sh
# Triggers specific functions to install and configure stx-integ
echo_summary "$STX_TIS_NAME devstack plugin.sh called: $1/$2"
# check for service enabled
if is_service_enabled $STX_TIS_NAME; then
if [[ "$1" == "stack" && "$2" == "install" ]]; then
# Perform installation of source
echo_summary "Install $STX_TIS_NAME"
if is_service_enabled $STX_CONFIG_NAME; then
install_config
fi
if is_service_enabled $STX_FAULT_NAME; then
install_fault
fi
if is_service_enabled $STX_METAL_NAME; then
install_maintenance
fi
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
echo_summary "Configure $STX_TIS_NAME"
if is_service_enabled $STX_CONFIG_NAME; then
configure_config
fi
if is_service_enabled $STX_FAULT_NAME; then
configure_fault
create_fault_user_group
create_fault_accounts
fi
if is_service_enabled $STX_METAL_NAME; then
configure_maintenance
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize and start the service
echo_summary "Initialize and start $STX_TIS_NAME"
if is_service_enabled $STX_CONFIG_NAME; then
init_config
start_config
fi
if is_service_enabled $STX_FAULT_NAME; then
init_fault
start_fault
fi
if is_service_enabled $STX_METAL_NAME; then
start_maintenance
fi
elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then
# do sanity test
echo_summary "test-config $STX_TIS_NAME"
if is_service_enabled $STX_CONFIG_NAME; then
check_sysinv_services
fi
fi
if [[ "$1" == "unstack" ]]; then
# Shut down services
echo_summary "Stop $STX_TIS_NAME"
if is_service_enabled $STX_CONFIG_NAME; then
stop_config
fi
if is_service_enabled $STX_FAULT_NAME; then
stop_fault
fi
if is_service_enabled $STX_METAL_NAME; then
stop_maintenance
fi
fi
if [[ "$1" == "clean" ]]; then
echo_summary "Clean $STX_TIS_NAME"
if is_service_enabled $STX_CONFIG_NAME; then
cleanup_config
fi
if is_service_enabled $STX_FAULT_NAME; then
cleanup_fault
fi
if is_service_enabled $STX_METAL_NAME; then
clean_maintenance
fi
fi
fi

123
devstack/settings Normal file
View File

@ -0,0 +1,123 @@
#!/bin/bash
# Devstack settings
# This must not use any variables to work properly in OpenStack's DevStack playbook
define_plugin stx-tis-repo
STX_TIS_NAME=stx-tis-repo
enable_service $STX_TIS_NAME
# Global settings ----------
# STX_INST_DIR should be a non-root-writable place to install build artifacts
# For non-sudo installs set STX_INST_DIR to something like $DEST/usr
STX_INST_DIR=${STX_INST_DIR:-/usr/local}
STX_BIN_DIR=${STX_BIN_DIR:-$STX_INST_DIR/bin}
STX_SBIN_DIR=${STX_SBIN_DIR:-$STX_INST_DIR/sbin}
# Set up so we don't use sudo for installs when not necessary
STX_SUDO="sudo"
[[ -w $STX_INST_DIR ]] && STX_SUDO="env"
# Settings for stx-config ----------
STX_CONFIG_NAME=stx-config
######### Plugin Specific ##########
#enable_service $STX_CONFIG_NAME
GITREPO[$STX_CONFIG_NAME]=$GIT_BASE/openstack/$STX_CONFIG_NAME
GITDIR[$STX_CONFIG_NAME]=$DEST/$STX_CONFIG_NAME
GITBRANCH[$STX_CONFIG_NAME]=master
# stx-integ
enable_service platform-util
# stx-update
enable_service sw-patch tsconfig
if is_service_enabled sysinv-agent; then
enable_service sysinv
fi
if is_service_enabled sysinv-agent; then
local req_services="key rabbit nova neutron"
for srv in $req_services;do
if ! is_service_enabled "$srv"; then
die $LINENO "$srv should be enabled for SysInv"
fi
done
fi
# Settings for stx-fault ----------
STX_FAULT_NAME=stx-fault
#enable_service $STX_FAULT_NAME
# emulate enable_plugin, can't call it because we don't actually want it enabled
GITREPO[$STX_FAULT_NAME]=$GIT_BASE/openstack/$STX_FAULT_NAME
GITDIR[$STX_FAULT_NAME]=$DEST/$STX_FAULT_NAME
GITBRANCH[$STX_FAULT_NAME]=master
# Circular dependencies are fun!
# fm-rest-api has an undeclared dependency on cgtsclient from stx-config
# so if that is not present we can't install it
if ! is_service_enabled stx-config; then
disable_service fm-rest-api
fi
# but fm-rest-api has its own (declared!) external dependencies too
if is_service_enabled fm-rest-api; then
# stx-update
enable_service tsconfig
fi
# Settings for stx-metal ----------
STX_METAL_NAME=stx-metal
#enable_service $STX_METAL_NAME
# emulate enable_plugin, can't call it because we don't actually want it enabled
GITREPO[$STX_METAL_NAME]=$GIT_BASE/openstack/$STX_METAL_NAME
GITDIR[$STX_METAL_NAME]=$DEST/$STX_METAL_NAME
GITBRANCH[$STX_METAL_NAME]=master
if is_service_enabled mtce-components; then
enable_service fsmon hbs hwmon mtce mtcalarm mtclog pmon rmon
fi
# Be careful to enable hostw, it will restart your host
# if some config is not correct
#enable_service hostw
if is_service_enabled mtce-compute; then
# stx-update
enable_service tsconfig
fi
# run_process checks whether the service name is enabled or not
if is_service_enabled hbs; then
# enable hbsAgent/hbsClient service as part of hbs service
enable_service hbsAgent
enable_service hbsClient
fi
if is_service_enabled mtce; then
# enable mtcAgent/mtcClient service as part of mtce service
enable_service mtcAgent
enable_service mtcClient
fi
if is_service_enabled hwmon && is_plugin_enabled stx-config; then
enable_service sysinv
fi
# Initial source of lib script
if is_service_enabled stx-config; then
source $DEST/stx-tis-repo/devstack/lib/stx-config
fi
if is_service_enabled stx-fault; then
source $DEST/stx-tis-repo/devstack/lib/stx-fault
fi
if is_service_enabled stx-metal; then
source $DEST/stx-tis-repo/devstack/lib/stx-metal
fi

2
test-requirements.txt Normal file
View File

@ -0,0 +1,2 @@
hacking!=0.13.0,<0.14,>=0.12.0
bashate >= 0.2

34
tox.ini Normal file
View File

@ -0,0 +1,34 @@
[tox]
envlist = linters
minversion = 2.3
skipsdist = True
[testenv]
install_command = pip install -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps = -r{toxinidir}/test-requirements.txt
[testenv:linters]
whitelist_externals = bash
# Ignore bashate:
# - E006 Line too long
commands =
bash -c "find {toxinidir} \
-not \( -type d -name .?\* -prune \) \
-type f \
-not -name \*~ \
-not -name \*.md \
\( \
-name \*.sh \
-or -not -wholename \*/devstack/files/\* \
-wholename \*/devstack/\* \
\) \
-print0 | xargs -0 bashate -v -iE006"
[testenv:functional]
basepython = python3
whitelist_externals = cat
commands = cat /etc/group