Merge "Add devstack job and fix linters"

This commit is contained in:
Zuul 2019-02-11 20:41:30 +00:00 committed by Gerrit Code Review
commit 348857cc49
5 changed files with 181 additions and 121 deletions

View File

@ -8,6 +8,8 @@
- build-openstack-releasenotes - build-openstack-releasenotes
- openstack-tox-linters - openstack-tox-linters
- openstack-tox-pep8 - openstack-tox-pep8
- stx-devstack-metal:
voting: false
gate: gate:
jobs: jobs:
- build-openstack-api-ref - build-openstack-api-ref
@ -19,3 +21,36 @@
- publish-stx-api-ref - publish-stx-api-ref
- publish-stx-tox - publish-stx-tox
- publish-stx-releasenotes - publish-stx-releasenotes
- job:
name: stx-devstack-metal
parent: stx-devstack-base
timeout: 7800
required-projects:
- openstack/stx-update
- openstack/stx-fault
- openstack/stx-nfv
vars:
tox_envlist: functional
devstack_services:
horizon: false
# StarlingX services
fm-common: true
fm-api: true
mtce: true
mtce-compute: true
mtce-control: true
mtce-storage: true
fsmon: true
hbs: true
hwmon: true
mtcalarm: true
mtclog: true
pmon: true
rmon: true
devstack_plugins:
stx-fault: git://git.starlingx.io/stx-fault
stx-nfv: git://git.starlingx.io/stx-nfv
stx-update: git://git.starlingx.io/stx-update
files:
- ^devstack/.*

View File

@ -48,18 +48,77 @@ SW_VERSION=18.10
# Functions # Functions
# --------- # ---------
function uninstall_files() {
local dest_dir=$1
local dest_file_array=($2)
local file=""
for (( i=0; i<${#dest_file_array[*]}; i++ )); do function build_mtce {
file=${dest_file_array[$i]##*/} pushd ${STX_METAL_DIR}/mtce/src
sudo rm -rf $dest_dir/$file
done 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
make \
MAJOR=${major} \
MINOR=${minor} \
CCFLAGS=' -g -O2 -Wall -Wextra -std=c++11 -DBUILDINFO="\"$$(date)\""' \
build
popd
}
function build_mtce_common {
pushd ${STX_METAL_DIR}/mtce-common/src
local major minor version x
if [[ -z $1 || -z $2 ]]; then
# get mtce-common version
read x version <<< $(grep '^Version:' ${STX_METAL_DIR}/mtce/PKG-INFO)
major=${version%%.*}
minor=${version##*.}
else
major=$1
minor=$2
fi
# build
make \
MAJOR=${major} \
MINOR=${minor} \
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 { function install_mtce_common {
pushd ${STX_METAL_DIR}/mtce-common/src
local x version local x version
# get mtce-common version # get mtce-common version
@ -67,15 +126,13 @@ function install_mtce_common {
local major=${version%%.*} local major=${version%%.*}
local minor=${version##*.} local minor=${version##*.}
build_mtce_common
local lib64_dir=${PREFIX}/lib64 local lib64_dir=${PREFIX}/lib64
local inc_dir=${PREFIX}/include local inc_dir=${PREFIX}/include
local inc_dir_common=${PREFIX}/include/mtce-common local inc_dir_common=${PREFIX}/include/mtce-common
local inc_dir_daemon=${PREFIX}/include/mtce-daemon local inc_dir_daemon=${PREFIX}/include/mtce-daemon
# build
pushd ${STX_METAL_DIR}/mtce-common/src
make MAJOR=${major} MINOR=${minor} CCFLAGS=' -g -O2 -Wall -Wextra -std=c++11 -DBUILDINFO="\"$$(date)\""' build
local libdaecom_file=( \ local libdaecom_file=( \
"common/libcommon.a" \ "common/libcommon.a" \
"common/libthreadUtil.a" \ "common/libthreadUtil.a" \
@ -200,6 +257,8 @@ function install_mtce_storage {
} }
function install_mtce { function install_mtce {
pushd ${STX_METAL_DIR}/mtce/src
local x version local x version
# get mtce version # get mtce version
@ -207,6 +266,8 @@ function install_mtce {
local major=${version%%.*} local major=${version%%.*}
local minor=${version##*.} local minor=${version##*.}
build_mtce $major $minor
local bin_dir=${PREFIX}/local/bin local bin_dir=${PREFIX}/local/bin
local sbin_dir=${PREFIX}/local/sbin local sbin_dir=${PREFIX}/local/sbin
local lib_dir=${PREFIX}/lib local lib_dir=${PREFIX}/lib
@ -221,10 +282,6 @@ function install_mtce {
local local_etc_servicesd=${sysconf_dir}/services.d local local_etc_servicesd=${sysconf_dir}/services.d
local local_etc_logrotated=${sysconf_dir}/logrotate.d local local_etc_logrotated=${sysconf_dir}/logrotate.d
# build
pushd ${STX_METAL_DIR}/mtce/src
make MAJOR=${major} MINOR=${minor} CCFLAGS=' -g -O2 -Wall -Wextra -std=c++11 -DBUILDINFO="\"$$(date)\""' build
# install # install
if [ ! -d "/etc/rc.d" ]; then if [ ! -d "/etc/rc.d" ]; then
sudo mkdir -p /etc/rc.d sudo mkdir -p /etc/rc.d
@ -354,7 +411,7 @@ function install_mtce {
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/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/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 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/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 sudo install -m 755 -p -D rmon/scripts/rmon_reload_on_cpe.sh ${local_etc_goenabledd}/rmon_reload_on_cpe.sh
# log rotation # log rotation
@ -380,14 +437,6 @@ function install_mtce {
sudo ln -sf librmonapi.so.${major} librmonapi.so.${major}.${minor} sudo ln -sf librmonapi.so.${major} librmonapi.so.${major}.${minor}
sudo ln -sf librmonapi.so.${major} librmonapi.so sudo ln -sf librmonapi.so.${major} librmonapi.so
popd popd
}
function install_maintenance {
install_mtce_common
# components could be seperatly installed if
# installation is well controlled in Makefile
install_mtce
} }
function configure_maintenance { function configure_maintenance {
@ -452,7 +501,6 @@ function configure_maintenance {
} }
function start_mtcAgent { function start_mtcAgent {
echo "trigger start mtc agent service"
# add admin compute endpoint # add admin compute endpoint
if is_service_enabled nova; then if is_service_enabled nova; then
source openrc admin admin source openrc admin admin
@ -470,8 +518,6 @@ function start_mtcAgent {
} }
function start_hbsAgent { function start_hbsAgent {
echo "trigger start hbs agent service"
# copy hbsAgent.service template to devstack # copy hbsAgent.service template to devstack
sudo cp ${PREFIX}/lib/systemd/system/hbsAgent.service \ sudo cp ${PREFIX}/lib/systemd/system/hbsAgent.service \
${SYSCONFDIR}/systemd/system/devstack@hbsAgent.service ${SYSCONFDIR}/systemd/system/devstack@hbsAgent.service
@ -479,7 +525,6 @@ function start_hbsAgent {
} }
function start_hwmon { function start_hwmon {
echo "trigger start hwmon service"
# init hwmon # init hwmon
iniset -sudo /etc/systemd/system/devstack@hwmon.service "Service" "Type" "forking" 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" iniset -sudo /etc/systemd/system/devstack@hwmon.service "Service" "PIDFile" "/var/run/hwmond.pid"
@ -491,16 +536,13 @@ function start_mtce_control {
# Oneshot goenabled control # Oneshot goenabled control
sudo ${SYSCONFDIR}/init.d/goenabledControl start sudo ${SYSCONFDIR}/init.d/goenabledControl start
if is_service_enabled mtce; then if is_service_enabled mtce-agent || is_service_enabled mtce; then
echo "start mtcAgent"
start_mtcAgent start_mtcAgent
fi fi
if is_service_enabled hbs; then if is_service_enabled hbs-agent || is_service_enabled hbs; then
echo "start hbsAgent"
start_hbsAgent start_hbsAgent
fi fi
if is_service_enabled hwmon; then if is_service_enabled hwmon && is_service_enabled sysinv; then
echo "start hwmon"
start_hwmon start_hwmon
fi fi
} }
@ -524,45 +566,45 @@ function start_mtce_storage {
} }
function start_maintenance { 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 start_goenabled
if is_service_enabled hbs; then if is_service_enabled hbs; then
echo "start hbs client service"
start_hbsClient start_hbsClient
fi fi
if is_service_enabled mtce; then if is_service_enabled mtce; then
echo "start mtce client service"
start_mtcClient start_mtcClient
fi fi
if is_service_enabled rmon; then if is_service_enabled rmon; then
echo "start rmon service"
start_rmon start_rmon
fi fi
if is_service_enabled mtclog; then if is_service_enabled mtclog; then
echo "start mtclog service"
start_mtclog start_mtclog
fi fi
if is_service_enabled mtcalarm; then if is_service_enabled mtcalarm; then
echo "start mtcalarm service"
start_mtcalarm start_mtcalarm
fi fi
if is_service_enabled fsmon; then if is_service_enabled fsmon; then
echo "start fsmon service"
start_fsmon start_fsmon
fi fi
if is_service_enabled pmon; then if is_service_enabled pmon; then
echo "start pmon service"
start_pmon start_pmon
fi fi
if is_service_enabled hostw; then if is_service_enabled hostw; then
echo "start hostw service"
start_hostw start_hostw
fi fi
} }
function start_mtcClient { function start_mtcClient {
echo "trigger start mtce client service"
# copy mtcClient.service template to devstack # copy mtcClient.service template to devstack
sudo cp ${PREFIX}/lib/systemd/system/mtcClient.service \ sudo cp ${PREFIX}/lib/systemd/system/mtcClient.service \
${SYSCONFDIR}/systemd/system/devstack@mtcClient.service ${SYSCONFDIR}/systemd/system/devstack@mtcClient.service
@ -570,8 +612,6 @@ function start_mtcClient {
} }
function start_hbsClient { function start_hbsClient {
echo "trigger start hbs client service"
# copy hbsClient.service template to devstack # copy hbsClient.service template to devstack
sudo cp ${PREFIX}/lib/systemd/system/hbsClient.service \ sudo cp ${PREFIX}/lib/systemd/system/hbsClient.service \
${SYSCONFDIR}/systemd/system/devstack@hbsClient.service ${SYSCONFDIR}/systemd/system/devstack@hbsClient.service
@ -579,8 +619,6 @@ function start_hbsClient {
} }
function start_pmon { function start_pmon {
echo "trigger start pmon service"
# copy pmon.service template to devstack # copy pmon.service template to devstack
sudo cp ${PREFIX}/lib/systemd/system/pmon.service \ sudo cp ${PREFIX}/lib/systemd/system/pmon.service \
${SYSCONFDIR}/systemd/system/devstack@pmon.service ${SYSCONFDIR}/systemd/system/devstack@pmon.service
@ -589,8 +627,6 @@ function start_pmon {
} }
function start_rmon { function start_rmon {
echo "trigger start rmon service"
# copy rmon.service template to devstack # copy rmon.service template to devstack
sudo cp ${PREFIX}/lib/systemd/system/rmon.service \ sudo cp ${PREFIX}/lib/systemd/system/rmon.service \
${SYSCONFDIR}/systemd/system/devstack@rmon.service ${SYSCONFDIR}/systemd/system/devstack@rmon.service
@ -599,8 +635,6 @@ function start_rmon {
} }
function start_mtclog { function start_mtclog {
echo "trigger start mtclog service"
# copy mtclog.service template to devstack # copy mtclog.service template to devstack
sudo cp ${PREFIX}/lib/systemd/system/mtclog.service \ sudo cp ${PREFIX}/lib/systemd/system/mtclog.service \
${SYSCONFDIR}/systemd/system/devstack@mtclog.service ${SYSCONFDIR}/systemd/system/devstack@mtclog.service
@ -609,8 +643,6 @@ function start_mtclog {
} }
function start_mtcalarm { function start_mtcalarm {
echo "trigger start mtcalarm service"
# copy mtcalarm.service template to devstack # copy mtcalarm.service template to devstack
sudo cp ${PREFIX}/lib/systemd/system/mtcalarm.service \ sudo cp ${PREFIX}/lib/systemd/system/mtcalarm.service \
${SYSCONFDIR}/systemd/system/devstack@mtcalarm.service ${SYSCONFDIR}/systemd/system/devstack@mtcalarm.service
@ -619,13 +651,10 @@ function start_mtcalarm {
} }
function start_goenabled { function start_goenabled {
echo "trigger start goenabled service"
sudo ${SYSCONFDIR}/init.d/goenabled start sudo ${SYSCONFDIR}/init.d/goenabled start
} }
function start_fsmon { function start_fsmon {
echo "trigger start fsmon service"
# copy fsmon.service template to devstack # copy fsmon.service template to devstack
sudo cp ${PREFIX}/lib/systemd/system/fsmon.service \ sudo cp ${PREFIX}/lib/systemd/system/fsmon.service \
${SYSCONFDIR}/systemd/system/devstack@fsmon.service ${SYSCONFDIR}/systemd/system/devstack@fsmon.service
@ -634,8 +663,6 @@ function start_fsmon {
} }
function start_hostw { function start_hostw {
echo "trigger start hostw service"
# copy hostw.service template to devstack # copy hostw.service template to devstack
sudo cp ${PREFIX}/lib/systemd/system/hostw.service \ sudo cp ${PREFIX}/lib/systemd/system/hostw.service \
${SYSCONFDIR}/systemd/system/devstack@hostw.service ${SYSCONFDIR}/systemd/system/devstack@hostw.service
@ -658,16 +685,13 @@ function stop_hwmon {
function stop_mtce_control { function stop_mtce_control {
sudo ${SYSCONFDIR}/init.d/goenabledControl stop sudo ${SYSCONFDIR}/init.d/goenabledControl stop
if is_service_enabled mtce; then if is_service_enabled mtce-agent || is_service_enabled mtce; then
echo "stop mtcAgent"
stop_mtcAgent stop_mtcAgent
fi fi
if is_service_enabled hbs; then if is_service_enabled hbs-agent || is_service_enabled hbs; then
echo "stop hbsAgent"
stop_hbsAgent stop_hbsAgent
fi fi
if is_service_enabled hwmon; then if is_service_enabled hwmon && is_service_enabled sysinv; then
echo "stop hwmon"
stop_hwmon stop_hwmon
fi fi
} }
@ -720,42 +744,42 @@ function stop_maintenance {
stop_goenabled stop_goenabled
if is_service_enabled pmon; then if is_service_enabled pmon; then
echo "stop pmon service"
stop_pmon stop_pmon
fi fi
if is_service_enabled mtce; then if is_service_enabled mtce; then
echo "stop mtce client service"
stop_mtcClient stop_mtcClient
fi fi
if is_service_enabled hbs; then if is_service_enabled hbs; then
echo "stop hbs client service"
stop_hbsClient stop_hbsClient
fi fi
if is_service_enabled rmon; then if is_service_enabled rmon; then
echo "stop rmon service"
stop_rmon stop_rmon
fi fi
if is_service_enabled mtclog; then if is_service_enabled mtclog; then
echo "stop mtclog service"
stop_mtclog stop_mtclog
fi fi
if is_service_enabled mtcalarm; then if is_service_enabled mtcalarm; then
echo "stop mtcalarm service"
stop_mtcalarm stop_mtcalarm
fi fi
if is_service_enabled fsmon; then if is_service_enabled fsmon; then
echo "stop fsmon service"
stop_fsmon stop_fsmon
fi fi
if is_service_enabled hostw; then if is_service_enabled hostw; then
echo "stop hostw service"
stop_hostw stop_hostw
fi 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 { function cleanup_metal {
echo "cleanup_metal"
# TODO: move it to Makefile uninstall # TODO: move it to Makefile uninstall
# remove mtce # remove mtce
local x version local x version
@ -987,4 +1011,15 @@ function cleanup_metal {
fi 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 $_XTRACE_STX_METAL

View File

@ -12,21 +12,9 @@ if is_service_enabled stx-metal; then
echo_summary "Pre-requires of stx-metal" echo_summary "Pre-requires of stx-metal"
elif [[ "$1" == "stack" && "$2" == "install" ]]; then elif [[ "$1" == "stack" && "$2" == "install" ]]; then
# Perform installation of source # Perform installation of source
echo_summary "Install metal" echo_summary "Install stx-metal"
# maintenance components should be installed in each node # maintenance components should be installed in each node
install_maintenance install_maintenance
if is_service_enabled mtce-compute; then
echo_summary "Install mtce compute specific services"
install_mtce_compute
fi
if is_service_enabled mtce-control; then
echo_summary "Install mtce control specific services"
install_mtce_control
fi
if is_service_enabled mtce-storage; then
echo_summary "Install mtce storage specific services"
install_mtce_storage
fi
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured # Configure after the other layer 1 and 2 services have been configured
echo_summary "Configure metal" echo_summary "Configure metal"
@ -34,19 +22,6 @@ if is_service_enabled stx-metal; then
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize and start the metal services # Initialize and start the metal services
echo_summary "Initialize and start metal " echo_summary "Initialize and start metal "
if is_service_enabled mtce-control; then
echo_summary "Start mtce control specific services"
# Start Agents on controller node
start_mtce_control
fi
if is_service_enabled mtce-compute; then
echo_summary "Start mtce compute specific services"
start_mtce_compute
fi
if is_service_enabled mtce-storage; then
echo_summary "Start mtce storage specific services"
start_mtce_storage
fi
# Start services on each node # Start services on each node
start_maintenance start_maintenance
elif [[ "$1" == "stack" && "$2" == "test" ]]; then elif [[ "$1" == "stack" && "$2" == "test" ]]; then
@ -59,19 +34,6 @@ if is_service_enabled stx-metal; then
echo_summary "Stop metal services" echo_summary "Stop metal services"
# Stop client services on each node # Stop client services on each node
stop_maintenance stop_maintenance
if is_service_enabled mtce-control; then
echo_summary "Stop mtce control specific services"
# Stop Agents on controller node
stop_mtce_control
fi
if is_service_enabled mtce-compute; then
echo_summary "Stop mtce compute specific services"
stop_mtce_compute
fi
if is_service_enabled mtce-storage; then
echo_summary "Stop mtce storage specific services"
stop_mtce_storage
fi
fi fi
if [[ "$1" == "clean" ]]; then if [[ "$1" == "clean" ]]; then

View File

@ -11,17 +11,33 @@
# functionality maintenance services. # functionality maintenance services.
# #
# Current configuration supports All-in-One simplex mode. # Current configuration supports All-in-One simplex mode.
#
# Servcies
# stx-metal - Overall enable for this plugin
#
# mtce
# mtce-control
# mtce-compute
# mtce-storage
#
# mtce-components (include all of the below)
# fsmon
# hbs
# hwmon
# mtcalarm
# mtclog
# pmon
# rmon
STX_METAL_NAME=stx-metal STX_METAL_NAME=stx-metal
######### Plugin Specific ########## ######### Plugin Specific ##########
# Enable service for node type # Enable service for node type
enable_service $STX_METAL_NAME mtce-compute mtce-control mtce-storage enable_service $STX_METAL_NAME
# TODO:remove the services enabled by default once if is_service_enabled mtce-components; then
# stx-metal is completely enabled enable_service fsmon hbs hwmon mtce mtcalarm mtclog pmon rmon
# Enable service for components fi
enable_service hbs mtce pmon rmon hwmon mtclog mtcalarm fsmon
# Be careful to enable hostw, it will restart your host # Be careful to enable hostw, it will restart your host
# if some config is not correct # if some config is not correct
@ -42,6 +58,9 @@ if is_service_enabled mtce; then
enable_service mtcAgent enable_service mtcAgent
enable_service mtcClient enable_service mtcClient
fi fi
if is_service_enabled hwmon && is_plugin_enabled stx-config; then
enable_service sysinv
fi
# Initial source of lib script # Initial source of lib script
source $DEST/stx-metal/devstack/lib/stx-metal source $DEST/stx-metal/devstack/lib/stx-metal

11
tox.ini
View File

@ -24,7 +24,11 @@ commands =
-type f \ -type f \
-not -name \*~ \ -not -name \*~ \
-not -name \*.md \ -not -name \*.md \
-name \*.sh \ \( \
-name \*.sh \
-or -not -wholename \*/devstack/files/\* \
-wholename \*/devstack/\* \
\) \
-print0 | xargs -n 1 -0 bashate -v -i E010,E006" -print0 | xargs -n 1 -0 bashate -v -i E010,E006"
bash -c "find {toxinidir} \ bash -c "find {toxinidir} \
\( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \ \( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \
@ -86,3 +90,8 @@ commands =
rm -rf api-ref/build rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
whitelist_externals = rm whitelist_externals = rm
[testenv:functional]
basepython = python3
whitelist_externals = cat
commands = cat /etc/mtc.ini