Support fine-grained service enablement
Allow cgtsclient to be installed without any of the other sysinv services or prerequisites. Also allow some selection within sysinv services. Change-Id: Ie8f10cb11111e9545103df001976295fc4aba3a6 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
This commit is contained in:
parent
5442d321d1
commit
b9ab8f9757
|
@ -179,12 +179,11 @@
|
|||
fm-api: true
|
||||
# fm-rest-api: true
|
||||
# fm-mgr: true
|
||||
cgtsclient: true
|
||||
sysinv-agent: true
|
||||
# Skip sysinv-api for now, needs more attention
|
||||
# sysinv-api: true
|
||||
sysinv-cond: true
|
||||
mysql: false
|
||||
postgresql: true
|
||||
tls-proxy: false
|
||||
devstack_plugins:
|
||||
stx-config: git://git.starlingx.io/stx-config
|
||||
|
|
|
@ -64,12 +64,20 @@ stx_services="sysinv-api sysinv-cond sysinv-agent"
|
|||
function check_sysinv_services {
|
||||
local service
|
||||
for service in $stx_services; do
|
||||
if $SYSTEMCTL is-enabled devstack@$service.service; then
|
||||
if [[is_service_enabled $service && $SYSTEMCTL is-enabled devstack@$service.service]]; then
|
||||
$SYSTEMCTL status devstack@$service.service --no-pager
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -119,11 +127,9 @@ function create_sysinv_cache_dir {
|
|||
|
||||
function create_sysinv_user_group {
|
||||
if ! getent group sysinv >/dev/null; then
|
||||
echo "Creating a group called sysinv"
|
||||
sudo groupadd sysinv
|
||||
fi
|
||||
if ! getent passwd sysinv >/dev/null; then
|
||||
echo "Creating a user called sysinv"
|
||||
sudo mkdir -p /home/sysinv
|
||||
sudo useradd -g sysinv -s /bin/bash -d /home/sysinv -m sysinv
|
||||
echo "Giving user sysinv passwordless sudo privileges"
|
||||
|
@ -144,16 +150,17 @@ function create_sysinv_user_group {
|
|||
}
|
||||
|
||||
function init_sysinv {
|
||||
echo "trigger init sysinv"
|
||||
# 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
|
||||
$SYSINV_BIN_DIR/sysinv-dbsync --config-file=$SYSINV_CONF_FILE
|
||||
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
|
||||
$SYSINV_BIN_DIR/sysinv-dbsync --config-file=$SYSINV_CONF_FILE
|
||||
fi
|
||||
create_sysinv_cache_dir
|
||||
fi
|
||||
create_sysinv_cache_dir
|
||||
}
|
||||
|
||||
function install_cgtsclient {
|
||||
|
@ -161,6 +168,20 @@ function install_cgtsclient {
|
|||
sudo install -D -m 0644 -o $STACK_USER {${GITDIR["$SYSINV_CLIENT_NAME"]}/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 $STXCONFIG_CONFUTILS -e
|
||||
|
@ -176,12 +197,6 @@ function install_controllerconfig {
|
|||
}
|
||||
|
||||
function install_sysinv {
|
||||
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
|
||||
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
|
||||
|
@ -200,10 +215,6 @@ function install_sysinv {
|
|||
sudo install -p -D -m 755 $SYSINV_DIR/sysinv/cmd/partition_info.sh $SYSINV_BIN_DIR/partition_info.sh
|
||||
sudo install -p -D -m 755 $SYSINV_DIR/sysinv/cmd/manage-partitions $SYSINV_BIN_DIR/manage-partitions
|
||||
sudo install -p -D -m 755 $SYSINV_DIR/sysinv/cmd/query_pci_id $SYSINV_BIN_DIR/query_pci_id
|
||||
if is_service_enabled sysinv-agent; then
|
||||
echo_summary "Installing sysinv-agent service"
|
||||
install_sysinv_agent
|
||||
fi
|
||||
}
|
||||
|
||||
function install_sysinv_agent {
|
||||
|
@ -211,35 +222,23 @@ function install_sysinv_agent {
|
|||
sudo install -p -D -m 755 $SYSINV_AGENT_DIR/sysinv-agent $SYSINV_BIN_DIR/sysinv-agent.sh
|
||||
}
|
||||
|
||||
function install_sysinv_depends {
|
||||
install_configutilities
|
||||
install_controllerconfig
|
||||
}
|
||||
|
||||
function start_sysinv {
|
||||
if is_service_enabled sysinv-api; then
|
||||
echo "start sysinv-api service"
|
||||
start_sysinv_api
|
||||
fi
|
||||
if is_service_enabled sysinv-cond; then
|
||||
echo "start sysinv-cond service"
|
||||
start_sysinv_conductor
|
||||
fi
|
||||
if is_service_enabled sysinv-agent; then
|
||||
echo "start sysinv-agent service"
|
||||
start_sysinv_agent
|
||||
fi
|
||||
}
|
||||
|
||||
function start_sysinv_agent {
|
||||
if is_service_enabled sysinv-agent; then
|
||||
echo "start sysinv-agent service"
|
||||
run_process sysinv-agent "$SYSINV_BIN_DIR/sysinv-agent"
|
||||
fi
|
||||
run_process sysinv-agent "$SYSINV_BIN_DIR/sysinv-agent"
|
||||
}
|
||||
|
||||
function start_sysinv_api {
|
||||
echo "trigger start sysinv api"
|
||||
run_process sysinv-api "$SYSINV_BIN_DIR/sysinv-api --config-file=$SYSINV_CONF_FILE"
|
||||
|
||||
# Get right service port for testing
|
||||
|
@ -260,7 +259,6 @@ function start_sysinv_api {
|
|||
}
|
||||
|
||||
function start_sysinv_conductor {
|
||||
echo "trigger start sysinv conductor"
|
||||
# the 1st will fail
|
||||
stop_sysinv_conductor
|
||||
run_process sysinv-cond "$SYSINV_BIN_DIR/sysinv-conductor --config-file=$SYSINV_CONF_FILE"
|
||||
|
@ -269,9 +267,15 @@ function start_sysinv_conductor {
|
|||
}
|
||||
|
||||
function stop_sysinv {
|
||||
stop_sysinv_api
|
||||
stop_sysinv_conductor
|
||||
stop_sysinv_agent
|
||||
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 {
|
||||
|
|
|
@ -9,18 +9,12 @@ echo_summary "sysinv devstack plugin.sh called: $1/$2"
|
|||
if is_service_enabled stx-config; then
|
||||
if [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||
# Perform installation of source
|
||||
echo_summary "Installing cgts_client"
|
||||
install_cgtsclient
|
||||
echo_summary "Installing depends"
|
||||
install_sysinv_depends
|
||||
echo_summary "Installing sysinv service"
|
||||
install_sysinv
|
||||
echo_summary "Installing stx-config"
|
||||
install_config
|
||||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||
# Configure after the other layer 1 and 2 services have been configured
|
||||
echo_summary "Configure sysinv"
|
||||
configure_sysinv
|
||||
create_sysinv_user_group
|
||||
create_sysinv_accounts
|
||||
configure_config
|
||||
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||
# Initialize and start the sysinv service
|
||||
echo_summary "Initialize and start sysinv "
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
#!/bin/bash
|
||||
# Devstack settings
|
||||
|
||||
# Services
|
||||
# cgtsclient
|
||||
# sysinv
|
||||
# sysinv-agent
|
||||
# sysinv-api
|
||||
# sysinv-cond
|
||||
|
||||
# Defaults
|
||||
# --------
|
||||
|
||||
|
@ -21,5 +28,18 @@ 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
|
||||
|
||||
# Initial source of lib script
|
||||
source $DEST/stx-config/devstack/lib/stx-config
|
||||
|
|
Loading…
Reference in New Issue