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-api: true
|
||||||
# fm-rest-api: true
|
# fm-rest-api: true
|
||||||
# fm-mgr: true
|
# fm-mgr: true
|
||||||
|
cgtsclient: true
|
||||||
sysinv-agent: true
|
sysinv-agent: true
|
||||||
# Skip sysinv-api for now, needs more attention
|
# Skip sysinv-api for now, needs more attention
|
||||||
# sysinv-api: true
|
# sysinv-api: true
|
||||||
sysinv-cond: true
|
sysinv-cond: true
|
||||||
mysql: false
|
|
||||||
postgresql: true
|
|
||||||
tls-proxy: false
|
tls-proxy: false
|
||||||
devstack_plugins:
|
devstack_plugins:
|
||||||
stx-config: git://git.starlingx.io/stx-config
|
stx-config: git://git.starlingx.io/stx-config
|
||||||
|
|
|
@ -64,12 +64,20 @@ stx_services="sysinv-api sysinv-cond sysinv-agent"
|
||||||
function check_sysinv_services {
|
function check_sysinv_services {
|
||||||
local service
|
local service
|
||||||
for service in $stx_services; do
|
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
|
$SYSTEMCTL status devstack@$service.service --no-pager
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function configure_config {
|
||||||
|
if is_service_enabled sysinv; then
|
||||||
|
configure_sysinv
|
||||||
|
create_sysinv_user_group
|
||||||
|
create_sysinv_accounts
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function configure_sysinv {
|
function configure_sysinv {
|
||||||
sudo install -d -o $STACK_USER $SYSINV_CONF_DIR
|
sudo install -d -o $STACK_USER $SYSINV_CONF_DIR
|
||||||
cp $SYSINV_DIR/etc/sysinv/sysinv.conf.sample $SYSINV_CONF_FILE
|
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 {
|
function create_sysinv_user_group {
|
||||||
if ! getent group sysinv >/dev/null; then
|
if ! getent group sysinv >/dev/null; then
|
||||||
echo "Creating a group called sysinv"
|
|
||||||
sudo groupadd sysinv
|
sudo groupadd sysinv
|
||||||
fi
|
fi
|
||||||
if ! getent passwd sysinv >/dev/null; then
|
if ! getent passwd sysinv >/dev/null; then
|
||||||
echo "Creating a user called sysinv"
|
|
||||||
sudo mkdir -p /home/sysinv
|
sudo mkdir -p /home/sysinv
|
||||||
sudo useradd -g sysinv -s /bin/bash -d /home/sysinv -m sysinv
|
sudo useradd -g sysinv -s /bin/bash -d /home/sysinv -m sysinv
|
||||||
echo "Giving user sysinv passwordless sudo privileges"
|
echo "Giving user sysinv passwordless sudo privileges"
|
||||||
|
@ -144,7 +150,7 @@ function create_sysinv_user_group {
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_sysinv {
|
function init_sysinv {
|
||||||
echo "trigger init sysinv"
|
if is_service_enabled sysinv; then
|
||||||
# Migrations need this
|
# Migrations need this
|
||||||
sudo install -d -m 755 -o ${USER} /var/run/sysinv
|
sudo install -d -m 755 -o ${USER} /var/run/sysinv
|
||||||
if [[ "$HOST_TOPOLOGY_ROLE" != "subnode" ]]; then
|
if [[ "$HOST_TOPOLOGY_ROLE" != "subnode" ]]; then
|
||||||
|
@ -154,6 +160,7 @@ function init_sysinv {
|
||||||
$SYSINV_BIN_DIR/sysinv-dbsync --config-file=$SYSINV_CONF_FILE
|
$SYSINV_BIN_DIR/sysinv-dbsync --config-file=$SYSINV_CONF_FILE
|
||||||
fi
|
fi
|
||||||
create_sysinv_cache_dir
|
create_sysinv_cache_dir
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_cgtsclient {
|
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
|
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 {
|
function install_configutilities {
|
||||||
# We can't use setup_develop as there is no setup.cfg file present for configutilities
|
# We can't use setup_develop as there is no setup.cfg file present for configutilities
|
||||||
setup_package $STXCONFIG_CONFUTILS -e
|
setup_package $STXCONFIG_CONFUTILS -e
|
||||||
|
@ -176,12 +197,6 @@ function install_controllerconfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_sysinv {
|
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
|
setup_develop $SYSINV_DIR
|
||||||
sudo install -d -m 755 $SYSINV_ETC_GOENABLEDD
|
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 -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/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/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
|
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 {
|
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
|
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 {
|
function start_sysinv {
|
||||||
if is_service_enabled sysinv-api; then
|
if is_service_enabled sysinv-api; then
|
||||||
echo "start sysinv-api service"
|
|
||||||
start_sysinv_api
|
start_sysinv_api
|
||||||
fi
|
fi
|
||||||
if is_service_enabled sysinv-cond; then
|
if is_service_enabled sysinv-cond; then
|
||||||
echo "start sysinv-cond service"
|
|
||||||
start_sysinv_conductor
|
start_sysinv_conductor
|
||||||
fi
|
fi
|
||||||
if is_service_enabled sysinv-agent; then
|
if is_service_enabled sysinv-agent; then
|
||||||
echo "start sysinv-agent service"
|
|
||||||
start_sysinv_agent
|
start_sysinv_agent
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_sysinv_agent {
|
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"
|
run_process sysinv-agent "$SYSINV_BIN_DIR/sysinv-agent"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_sysinv_api {
|
function start_sysinv_api {
|
||||||
echo "trigger start sysinv api"
|
|
||||||
run_process sysinv-api "$SYSINV_BIN_DIR/sysinv-api --config-file=$SYSINV_CONF_FILE"
|
run_process sysinv-api "$SYSINV_BIN_DIR/sysinv-api --config-file=$SYSINV_CONF_FILE"
|
||||||
|
|
||||||
# Get right service port for testing
|
# Get right service port for testing
|
||||||
|
@ -260,7 +259,6 @@ function start_sysinv_api {
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_sysinv_conductor {
|
function start_sysinv_conductor {
|
||||||
echo "trigger start sysinv conductor"
|
|
||||||
# the 1st will fail
|
# the 1st will fail
|
||||||
stop_sysinv_conductor
|
stop_sysinv_conductor
|
||||||
run_process sysinv-cond "$SYSINV_BIN_DIR/sysinv-conductor --config-file=$SYSINV_CONF_FILE"
|
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 {
|
function stop_sysinv {
|
||||||
|
if is_service_enabled sysinv-api; then
|
||||||
stop_sysinv_api
|
stop_sysinv_api
|
||||||
|
fi
|
||||||
|
if is_service_enabled sysinv-cond; then
|
||||||
stop_sysinv_conductor
|
stop_sysinv_conductor
|
||||||
|
fi
|
||||||
|
if is_service_enabled sysinv-agent; then
|
||||||
stop_sysinv_agent
|
stop_sysinv_agent
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop_sysinv_agent {
|
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 is_service_enabled stx-config; then
|
||||||
if [[ "$1" == "stack" && "$2" == "install" ]]; then
|
if [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||||
# Perform installation of source
|
# Perform installation of source
|
||||||
echo_summary "Installing cgts_client"
|
echo_summary "Installing stx-config"
|
||||||
install_cgtsclient
|
install_config
|
||||||
echo_summary "Installing depends"
|
|
||||||
install_sysinv_depends
|
|
||||||
echo_summary "Installing sysinv service"
|
|
||||||
install_sysinv
|
|
||||||
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 sysinv"
|
echo_summary "Configure sysinv"
|
||||||
configure_sysinv
|
configure_config
|
||||||
create_sysinv_user_group
|
|
||||||
create_sysinv_accounts
|
|
||||||
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||||
# Initialize and start the sysinv service
|
# Initialize and start the sysinv service
|
||||||
echo_summary "Initialize and start sysinv "
|
echo_summary "Initialize and start sysinv "
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Devstack settings
|
# Devstack settings
|
||||||
|
|
||||||
|
# Services
|
||||||
|
# cgtsclient
|
||||||
|
# sysinv
|
||||||
|
# sysinv-agent
|
||||||
|
# sysinv-api
|
||||||
|
# sysinv-cond
|
||||||
|
|
||||||
# Defaults
|
# Defaults
|
||||||
# --------
|
# --------
|
||||||
|
|
||||||
|
@ -21,5 +28,18 @@ enable_service platform-util
|
||||||
# stx-update
|
# stx-update
|
||||||
enable_service sw-patch tsconfig
|
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
|
# Initial source of lib script
|
||||||
source $DEST/stx-config/devstack/lib/stx-config
|
source $DEST/stx-config/devstack/lib/stx-config
|
||||||
|
|
Loading…
Reference in New Issue