ce095fb697
Story: 2005265 Task: 30092 Change-Id: Id82b93d30736ed7a386c93f34a6a5be88b7a3552 Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
628 lines
23 KiB
Bash
628 lines
23 KiB
Bash
#!/bin/bash
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Copyright (C) 2019 Intel Corporation
|
|
#
|
|
|
|
# lib/stx-nfv
|
|
|
|
_XTRACE_STX_NFV=$(set +o | grep xtrace)
|
|
set -o xtrace
|
|
|
|
# Defaults
|
|
# --------
|
|
|
|
STXNFV_DIR=${GITDIR[$STX_NFV_NAME]}
|
|
STXNFV_SYSCONFDIR=/etc
|
|
STXNFV_OCF_ROOT=/usr/lib/ocf
|
|
|
|
NFV_DIR=$STXNFV_DIR/nfv
|
|
NFV_CONF_DIR=$STXNFV_SYSCONFDIR/nfv
|
|
NFV_OCF_DIR=$STXNFV_OCF_ROOT/resource.d/nfv
|
|
NFV_CLIENT_DIR=$NFV_DIR/nfv-client
|
|
NFV_COMMON_DIR=$NFV_DIR/nfv-common
|
|
NFV_PLUGINS_DIR=$NFV_DIR/nfv-plugins
|
|
NFV_TOOLS_DIR=$NFV_DIR/nfv-tools
|
|
NFV_VIM_DIR=$NFV_DIR/nfv-vim
|
|
|
|
# nova-api-proxy
|
|
NOVA_API_PROXY_CONF=$STXNFV_SYSCONFDIR/proxy
|
|
NOVA_API_PROXY_DIR=$STXNFV_DIR/nova-api-proxy/nova-api-proxy
|
|
|
|
# mtce-guest
|
|
MTCE_GUEST_DIR=$STXNFV_DIR/mtce-guest
|
|
MTCE_GUEST_CONF=$STXNFV_SYSCONFDIR/mtc
|
|
MTCE_GUEST_OCF_DIR=$STXNFV_OCF_ROOT/resource.d/platform
|
|
|
|
# guest-agent
|
|
GUEST_AGENT_DIR=$STXNFV_DIR/guest-agent
|
|
GUEST_SCALE_AGENT_VER="2.0"
|
|
GUEST_SCALE_AGENT_DIR=$GUEST_AGENT_DIR/guest-scale-agent-$GUEST_SCALE_AGENT_VER
|
|
|
|
# guest-comm
|
|
GUEST_COMM_DIR=$STXNFV_DIR/guest-comm
|
|
HOST_AGENT_COMM_VER="2.0"
|
|
HOST_AGENT_COMM_DIR=$GUEST_COMM_DIR/host-guest-comm-$HOST_AGENT_COMM_VER
|
|
|
|
# guest-client
|
|
GUEST_CLIENT_VERSION="3.0.1"
|
|
|
|
STX_SDK_DEPLOY_DIR=${STX_SDK_DEPLOY_DIR:-/opt/deploy/cgcs_sdk}
|
|
|
|
# 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_INST_DIR/bin
|
|
|
|
# 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 cleanup_guest_agent {
|
|
sudo rm -rf $MTCE_GUEST_OCF_DIR/guestAgent
|
|
sudo rm -rf $MTCE_GUEST_CONF/guestAgent.ini
|
|
$STX_SUDO rm -rf $STX_INST_DIR/bin/guestAgent
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/init.d/guestAgent
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/logrotate.d/guestAgent.logrotate
|
|
}
|
|
|
|
function cleanup_guest_client {
|
|
$STX_SUDO rm -rf $STX_INST_DIR/include/guest-client
|
|
sudo rm -rf $STX_SDK_DEPLOY_DIR
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/systemd/system/guest-client.service
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/guest-client
|
|
$STX_SUDO rm -rf $STX_INST_DIR/bin/guest-client
|
|
$STX_SUDO rm -rf $STX_INST_DIR/lib/libguest_common_api.so.$GUEST_CLIENT_VERSION
|
|
$STX_SUDO rm -rf $STX_INST_DIR/lib/libguest_heartbeat_api.so.$GUEST_CLIENT_VERSION
|
|
}
|
|
|
|
function cleanup_guest_server {
|
|
sudo rm -rf $MTCE_GUEST_CONF/guestServer.ini
|
|
$STX_SUDO rm -rf $STX_INST_DIR/bin/guestServer
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/init.d/guestServer
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/pmon.d/guestServer.conf
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/logrotate.d/guestServer.logrotate
|
|
}
|
|
|
|
function cleanup_guest_scale_helper {
|
|
$STX_SUDO rm -rf $STX_INST_DIR/sbin/guest_scale_helper
|
|
}
|
|
|
|
function cleanup_host_agent {
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/init.d/host_agent
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/pmon.d/host_agent.conf
|
|
$STX_SUDO rm -rf $STX_INST_DIR/sbin/host_agent
|
|
$STX_SUDO rm -rf $STX_INST_DIR/include/cgcs/guest_host_msg.h
|
|
$STX_SUDO rm -rf $STX_INST_DIR/include/cgcs/host_guest_msg.h
|
|
|
|
$STX_SUDO rm -rf $STX_INST_DIR/lib64/libguesthostmsg.so
|
|
$STX_SUDO rm -rf $STX_INST_DIR/lib64/libhostguestmsg.so
|
|
$STX_SUDO rm -rf $STX_INST_DIR/lib64/libservergroup.so
|
|
}
|
|
|
|
function cleanup_nfv {
|
|
if is_service_enabled nfv-vim || is_service_enabled nfv-vim-api || is_service_enabled nfv-vim-webserver; then
|
|
sudo rm -rf $NFV_CONF_DIR
|
|
sudo rm -rf $NFV_OCF_DIR
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/bash_completion.d/sw-manager
|
|
|
|
cleanup_nfv_vim
|
|
cleanup_nfv_common
|
|
cleanup_nfv_plugins
|
|
cleanup_nfv_tools
|
|
cleanup_nfv_client
|
|
fi
|
|
if is_service_enabled nfv-vim; then
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim.service
|
|
fi
|
|
if is_service_enabled nfv-vim-api; then
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-api.service
|
|
fi
|
|
if is_service_enabled nfv-vim-webserver; then
|
|
sudo rm -rf $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-webserver.service
|
|
fi
|
|
|
|
if is_service_enabled nova-api-proxy; then
|
|
cleanup_nova_api_proxy
|
|
fi
|
|
|
|
if is_service_enabled guest-client; then
|
|
cleanup_guest_client
|
|
fi
|
|
|
|
if is_service_enabled guest-agent || is_service_enabled guest-server; then
|
|
pushd $MTCE_GUEST_DIR/src
|
|
make clean
|
|
popd
|
|
fi
|
|
|
|
if is_service_enabled guest-agent; then
|
|
cleanup_guest_agent
|
|
fi
|
|
if is_service_enabled guest-server; then
|
|
cleanup_guest_server
|
|
fi
|
|
if is_service_enabled host-agent; then
|
|
cleanup_host_agent
|
|
fi
|
|
|
|
if is_service_enabled guest-scale-helper; then
|
|
cleanup_guest_scale_helper
|
|
fi
|
|
}
|
|
|
|
function cleanup_nfv_client {
|
|
pip_uninstall nfv-client
|
|
}
|
|
|
|
function cleanup_nfv_common {
|
|
pip_uninstall windriver-nfv-common-plugins
|
|
}
|
|
|
|
function cleanup_nfv_plugins {
|
|
pip_uninstall windriver-nfv-plugins
|
|
}
|
|
|
|
function cleanup_nfv_tools {
|
|
pip_uninstall nfv-tools
|
|
}
|
|
|
|
function cleanup_nfv_vim {
|
|
pip_uninstall nfv-vim
|
|
}
|
|
|
|
function cleanup_nova_api_proxy {
|
|
pip_uninstall api-proxy
|
|
}
|
|
|
|
function configure_guest_agent {
|
|
sudo sed -i "s%DAEMON=\"/usr/local/bin/\${DAEMON_NAME}\"%DAEMON=\"$STX_INST_DIR/local/bin/\${DAEMON_NAME}\"%" $STXNFV_SYSCONFDIR/init.d/guestAgent
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-agent.service "Service" "Type" "forking"
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-agent.service "Service" "PIDFile" "/var/run/guestAgent.pid"
|
|
}
|
|
|
|
function configure_guest_server {
|
|
sudo sed -i "s%DAEMON=\"/usr/local/bin/\${DAEMON_NAME}\"%DAEMON=\"$STX_INST_DIR/local/bin/\${DAEMON_NAME}\"%" $STXNFV_SYSCONFDIR/init.d/guestServer
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-server.service "Service" "Type" "forking"
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-server.service "Service" "PIDFile" "/var/run/guestServer.pid"
|
|
}
|
|
|
|
function configure_host_agent {
|
|
sudo sed -i "s%DAEMON=/usr/sbin/host_agent%DAEMON=$STX_INST_DIR/sbin/host_agent%" $STXNFV_SYSCONFDIR/init.d/host_agent
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@host-agent.service "Service" "Type" "forking"
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@host-agent.service "Service" "PIDFile" "/var/run/host_agent.pid"
|
|
}
|
|
|
|
function configure_mtce_guest_common {
|
|
# the content related to "controller" in /etc/hosts is generated by stx-metal
|
|
# devstack plugin. for the time being, there are no entries about oamcontroller,
|
|
# pxecontroller, ipv6, etc. so here we use a simple regular expression.
|
|
if grep -q "^[0-9]\{1,3\}.*\s\+controller$" /etc/hosts; then
|
|
sudo sed -i "s%^[0-9]\{1,3\}.*\s\+controller$%$HOST_IP controller%" /etc/hosts
|
|
else
|
|
echo "$HOST_IP controller" | sudo tee -a "/etc/hosts"
|
|
fi
|
|
if grep -q "^[0-9]\{1,3\}.*\s\+.*controller-0$" /etc/hosts; then
|
|
sudo sed -i "s%^[0-9]\{1,3\}.*\s\+controller-0$%$HOST_IP controller-0%" /etc/hosts
|
|
else
|
|
echo "$HOST_IP controller-0" | sudo tee -a "/etc/hosts"
|
|
fi
|
|
if [ -f "/etc/platform/.initial_config_complete" ]; then
|
|
sudo touch /etc/platform/.initial_config_complete
|
|
fi
|
|
if [ -f "/var/run/.goenabled" ]; then
|
|
sudo touch /var/run/.goenabled
|
|
fi
|
|
}
|
|
|
|
function configure_nfv {
|
|
if is_service_enabled nfv-vim || is_service_enabled nfv-vim-api || is_service_enabled nfv-vim-webserver; then
|
|
configure_nfv_common
|
|
fi
|
|
|
|
if is_service_enabled nfv-vim; then
|
|
configure_nfv_vim
|
|
fi
|
|
if is_service_enabled nfv-vim-api; then
|
|
configure_nfv_vim_api
|
|
fi
|
|
if is_service_enabled nfv-vim-webserver; then
|
|
configure_nfv_vim_webserver
|
|
fi
|
|
|
|
if is_service_enabled nova-api-proxy; then
|
|
configure_nova_api_proxy
|
|
fi
|
|
|
|
if is_service_enabled guest-agent || is_service_enabled guest-server; then
|
|
configure_mtce_guest_common
|
|
fi
|
|
if is_service_enabled guest-agent; then
|
|
configure_guest_agent
|
|
fi
|
|
if is_service_enabled guest-server; then
|
|
configure_guest_server
|
|
fi
|
|
if is_service_enabled host-agent; then
|
|
configure_host_agent
|
|
fi
|
|
}
|
|
|
|
function configure_nfv_common {
|
|
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "platform" "authorization_ip" "$HOST_IP"
|
|
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "openstack" "authorization_ip" "$HOST_IP"
|
|
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "host" "$RABBIT_HOST"
|
|
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "user_id" "$RABBIT_USERID"
|
|
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "password" "$RABBIT_PASSWORD"
|
|
if [[ "${CELLSV2_SETUP}" == "singleconductor" ]]; then
|
|
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "virt_host" "/"
|
|
else
|
|
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "virt_host" "nova_cell1"
|
|
fi
|
|
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "host-listener" "host" "$HOST_IP"
|
|
|
|
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_CONF_DIR/vim/config.ini
|
|
sudo sed -i -e "s|@PYTHONROOT@|${PYTHON_SITE_DIR}|g" $NFV_CONF_DIR/vim/config.ini
|
|
iniset -sudo $NFV_CONF_DIR/vim/config.ini "sw-mgmt-configuration" "single_controller" "True"
|
|
iniset -sudo $NFV_CONF_DIR/vim/config.ini "vim-webserver" "host" "$HOST_IP"
|
|
}
|
|
|
|
function configure_nfv_vim {
|
|
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_OCF_DIR/vim
|
|
sudo sed -i -e 's|${OCF_ROOT}|@OCF_ROOT@|g' $NFV_OCF_DIR/vim
|
|
sudo sed -i -e "s|@OCF_ROOT@|${STXNFV_OCF_ROOT}|g" $NFV_OCF_DIR/vim
|
|
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim.service "Service" "Type" "forking"
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim.service "Service" "PIDFile" "/var/run/nfv-vim.pid"
|
|
}
|
|
|
|
function configure_nfv_vim_api {
|
|
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_OCF_DIR/vim-api
|
|
sudo sed -i -e 's|${OCF_ROOT}|@OCF_ROOT@|g' $NFV_OCF_DIR/vim-api
|
|
sudo sed -i -e "s|@OCF_ROOT@|${STXNFV_OCF_ROOT}|g" $NFV_OCF_DIR/vim-api
|
|
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-api.service "Service" "Type" "forking"
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-api.service "Service" "PIDFile" "/var/run/nfv-vim-api.pid"
|
|
}
|
|
|
|
function configure_nfv_vim_webserver {
|
|
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_OCF_DIR/vim-webserver
|
|
sudo sed -i -e 's|${OCF_ROOT}|@OCF_ROOT@|g' $NFV_OCF_DIR/vim-webserver
|
|
sudo sed -i -e "s|@OCF_ROOT@|${STXNFV_OCF_ROOT}|g" $NFV_OCF_DIR/vim-webserver
|
|
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-webserver.service "Service" "Type" "forking"
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-webserver.service "Service" "PIDFile" "/var/run/nfv-vim-webserver.pid"
|
|
}
|
|
|
|
function configure_nova_api_proxy {
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "DEFAULT" "pool_size" "256"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "DEFAULT" "nfvi_compute_listen_port" "30003"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "DEFAULT" "nfvi_compute_listen" "127.0.0.1"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "keystone_authtoken" "auth_type" "password"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "keystone_authtoken" "auth_url" "$KEYSTONE_SERVICE_URI"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "keystone_authtoken" "user_domain_name" "$SERVICE_DOMAIN_NAME"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "keystone_authtoken" "username" "nova"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "keystone_authtoken" "password" "$SERVICE_PASSWORD"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "keystone_authtoken" "project_domain_name" "$SERVICE_DOMAIN_NAME"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "keystone_authtoken" "project_name" "$SERVICE_PROJECT_NAME"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "keystone_authtoken" "admin_user" "nova"
|
|
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "keystone_authtoken" "admin_tenant_name" "$SERVICE_PROJECT_NAME"
|
|
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nova-api-proxy.service "Service" "Type" "simple"
|
|
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nova-api-proxy.service "Service" "PIDFile" "/var/run/nova-api-proxy.pid"
|
|
}
|
|
|
|
function install_guest_agent {
|
|
pushd $MTCE_GUEST_DIR/src
|
|
|
|
sudo install -m 755 -d $MTCE_GUEST_OCF_DIR
|
|
sudo install -m 755 -p -D scripts/guestAgent.ocf $MTCE_GUEST_OCF_DIR/guestAgent
|
|
sudo install -m 644 -p -D scripts/guest.ini $MTCE_GUEST_CONF/guestAgent.ini
|
|
$STX_SUDO install -m 755 -p -D guestAgent $STX_INST_DIR/local/bin/guestAgent
|
|
sudo install -m 755 -p -D scripts/guestAgent $STXNFV_SYSCONFDIR/init.d/guestAgent
|
|
sudo install -m 644 -p -D scripts/guestAgent.logrotate $STXNFV_SYSCONFDIR/logrotate.d/guestAgent.logrotate
|
|
|
|
popd
|
|
}
|
|
|
|
function install_guest_client {
|
|
pushd $STXNFV_DIR/guest-client/guest-client-$GUEST_CLIENT_VERSION
|
|
|
|
make clean
|
|
make build sysconfdir=$STXNFV_SYSCONFDIR
|
|
make sample
|
|
make tar ARCHIVE_NAME=wrs-guest-heartbeat-$GUEST_CLIENT_VERSION
|
|
find build
|
|
|
|
# Sudo Install for guest-client package
|
|
$STX_SUDO install -m 755 -d $STX_INST_DIR/include/guest-client
|
|
$STX_SUDO install -m 644 -p -D guest_client/src/heartbeat/guest_heartbeat_msg_defs.h $STX_INST_DIR/include/guest-client/guest_heartbeat_msg_defs.h
|
|
sudo install -d $STX_SDK_DEPLOY_DIR
|
|
sudo install -m 640 build/wrs-guest-heartbeat-$GUEST_CLIENT_VERSION.tgz $STX_SDK_DEPLOY_DIR
|
|
|
|
# Systemd services
|
|
sudo install -m 644 -p -D guest_client/scripts/guest-client.service $STXNFV_SYSCONFDIR/systemd/system/guest-client.service
|
|
sudo install -m 744 -p -D guest_client/scripts/guest-client.systemd $STXNFV_SYSCONFDIR/guest-client/guest-client.systemd
|
|
|
|
sudo install -m 750 -d $STXNFV_SYSCONFDIR/guest-client/heartbeat
|
|
sudo install -m 755 -p -D guest_client/scripts/guest_heartbeat.conf $STXNFV_SYSCONFDIR/guest-client/heartbeat/guest_heartbeat.conf
|
|
sudo install -m 755 -p -D guest_client/scripts/sample_event_handling_script $STXNFV_SYSCONFDIR/guest-client/heartbeat/sample_event_handling_script
|
|
sudo install -m 755 -p -D guest_client/scripts/sample_health_check_script $STXNFV_SYSCONFDIR/guest-client/heartbeat/sample_health_check_script
|
|
$STX_SUDO install -m 640 -p -D build/guest-client $STX_INST_DIR/bin/guest-client
|
|
$STX_SUDO install -m 640 -p -D build/libguest_common_api.so.$GUEST_CLIENT_VERSION $STX_INST_DIR/lib/libguest_common_api.so.$GUEST_CLIENT_VERSION
|
|
$STX_SUDO install -m 640 -p -D build/libguest_heartbeat_api.so.$GUEST_CLIENT_VERSION $STX_INST_DIR/lib/libguest_heartbeat_api.so.$GUEST_CLIENT_VERSION
|
|
|
|
popd
|
|
}
|
|
|
|
function install_host_agent {
|
|
pushd $HOST_AGENT_COMM_DIR
|
|
make all
|
|
|
|
sudo install -m 755 -p -D scripts/host_agent $STXNFV_SYSCONFDIR/init.d/host_agent
|
|
sudo install -m 640 -p -D scripts/host_agent.conf $STXNFV_SYSCONFDIR/pmon.d/host_agent.conf
|
|
$STX_SUDO install -m 755 -p -D bin/host_agent $STX_INST_DIR/sbin/host_agent
|
|
$STX_SUDO install -m 755 -d $STX_INST_DIR/include/cgcs
|
|
$STX_SUDO install -m 644 -p -D guest_host_msg.h $STX_INST_DIR/include/cgcs/guest_host_msg.h
|
|
$STX_SUDO install -m 644 -p -D host_guest_msg.h $STX_INST_DIR/include/cgcs/host_guest_msg.h
|
|
|
|
$STX_SUDO install -m 755 -p -D lib/libguesthostmsg.so $STX_INST_DIR/lib64/libguesthostmsg.so
|
|
$STX_SUDO install -m 755 -p -D lib/libhostguestmsg.so $STX_INST_DIR/lib64/libhostguestmsg.so
|
|
$STX_SUDO install -m 755 -p -D lib/libservergroup.so $STX_INST_DIR/lib64/libservergroup.so
|
|
|
|
popd
|
|
}
|
|
|
|
function install_guest_server {
|
|
pushd $MTCE_GUEST_DIR/src
|
|
|
|
sudo install -m 644 -p -D scripts/guest.ini $MTCE_GUEST_CONF/guestServer.ini
|
|
$STX_SUDO install -m 755 -p -D guestServer $STX_INST_DIR/local/bin/guestServer
|
|
sudo install -m 755 -p -D scripts/guestServer $STXNFV_SYSCONFDIR/init.d/guestServer
|
|
sudo install -m 755 -d $STXNFV_SYSCONFDIR/pmon.d
|
|
sudo install -m 644 -p -D scripts/guestServer.pmon $STXNFV_SYSCONFDIR/pmon.d/guestServer.conf
|
|
sudo install -m 644 -p -D scripts/guestServer.logrotate $STXNFV_SYSCONFDIR/logrotate.d/guestServer.logrotate
|
|
|
|
popd
|
|
}
|
|
|
|
function install_guest_scale_helper {
|
|
pushd $GUEST_SCALE_AGENT_DIR
|
|
make EXTRALDFLAGS="-L$STX_INST_DIR"/lib64 all
|
|
|
|
$STX_SUDO install -m 750 bin/guest_scale_helper $STX_INST_DIR/sbin/guest_scale_helper
|
|
|
|
popd
|
|
}
|
|
|
|
function install_mtce_guest_common {
|
|
pushd $MTCE_GUEST_DIR/src
|
|
make EXTRALDFLAGS="-L$STX_INST_DIR"/lib64 build
|
|
popd
|
|
|
|
sudo install -m 755 -d $(STXNFV_SYSCONFDIR)/logrotate.d
|
|
}
|
|
|
|
function install_nfv {
|
|
if is_service_enabled nfv-vim || is_service_enabled nfv-vim-api || is_service_enabled nfv-vim-webserver; then
|
|
install_nfv_vim
|
|
install_nfv_common
|
|
install_nfv_plugins
|
|
install_nfv_tools
|
|
install_nfv_client
|
|
fi
|
|
|
|
if is_service_enabled nova-api-proxy; then
|
|
install_nova_api_proxy
|
|
fi
|
|
if is_service_enabled guest-client; then
|
|
install_guest_client
|
|
fi
|
|
|
|
if is_service_enabled guest-agent || is_service_enabled guest-server; then
|
|
install_mtce_guest_common
|
|
fi
|
|
if is_service_enabled guest-agent; then
|
|
install_guest_agent
|
|
fi
|
|
if is_service_enabled guest-server; then
|
|
install_guest_server
|
|
fi
|
|
if is_service_enabled host-agent; then
|
|
install_host_agent
|
|
fi
|
|
|
|
if is_service_enabled guest-scale-helper; then
|
|
install_guest_scale_helper
|
|
fi
|
|
}
|
|
|
|
function install_nfv_client {
|
|
pushd $NFV_CLIENT_DIR
|
|
python setup.py build
|
|
sudo python setup.py install --root=/ --install-lib=${PYTHON_SITE_DIR} --single-version-externally-managed
|
|
popd
|
|
|
|
sudo install -d -m 755 $STXNFV_SYSCONFDIR/bash_completion.d
|
|
sudo install -m 444 $NFV_CLIENT_DIR/scripts/sw-manager.completion $STXNFV_SYSCONFDIR/bash_completion.d/sw-manager
|
|
}
|
|
|
|
function install_nfv_common {
|
|
pushd $NFV_COMMON_DIR
|
|
python setup.py build
|
|
sudo python setup.py install --root=/ --install-lib=${PYTHON_SITE_DIR} --single-version-externally-managed
|
|
popd
|
|
}
|
|
|
|
function install_nfv_plugins {
|
|
pushd $NFV_PLUGINS_DIR
|
|
python setup.py build
|
|
sudo python setup.py install --root=/ --install-lib=${PYTHON_SITE_DIR} --single-version-externally-managed
|
|
popd
|
|
|
|
sudo install -d -m 755 $NFV_CONF_DIR/nfv_plugins/
|
|
|
|
sudo install -d -m 755 $NFV_CONF_DIR/nfv_plugins/alarm_handlers/
|
|
sudo install -p -D -m 644 $NFV_PLUGINS_DIR/nfv_plugins/alarm_handlers/config.ini $NFV_CONF_DIR/nfv_plugins/alarm_handlers/config.ini
|
|
|
|
sudo install -d -m 755 $NFV_CONF_DIR/nfv_plugins/event_log_handlers/
|
|
sudo install -p -D -m 644 $NFV_PLUGINS_DIR/nfv_plugins/event_log_handlers/config.ini $NFV_CONF_DIR/nfv_plugins/event_log_handlers/config.ini
|
|
|
|
sudo install -d -m 755 $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/
|
|
sudo install -p -D -m 644 $NFV_PLUGINS_DIR/nfv_plugins/nfvi_plugins/config.ini $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini
|
|
sudo install -p -D -m 644 $NFV_PLUGINS_DIR/scripts/nfvi-plugins.logrotate $STXNFV_SYSCONFDIR/logrotate.d/nfvi-plugins.logrotate
|
|
}
|
|
|
|
function install_nfv_tools {
|
|
pushd $NFV_TOOLS_DIR
|
|
python setup.py build
|
|
sudo python setup.py install --root=/ --install-lib=${PYTHON_SITE_DIR} --single-version-externally-managed
|
|
popd
|
|
}
|
|
|
|
function install_nfv_vim {
|
|
pushd $NFV_VIM_DIR
|
|
python setup.py build
|
|
sudo python setup.py install --root=/ --install-lib=${PYTHON_SITE_DIR} --single-version-externally-managed
|
|
popd
|
|
|
|
sudo install -d -m 755 $NFV_CONF_DIR
|
|
sudo install -d -m 755 $NFV_OCF_DIR
|
|
sudo install -p -D -m 755 $NFV_VIM_DIR/scripts/vim $NFV_OCF_DIR/vim
|
|
sudo install -p -D -m 755 $NFV_VIM_DIR/scripts/vim-api $NFV_OCF_DIR/vim-api
|
|
sudo install -p -D -m 755 $NFV_VIM_DIR/scripts/vim-webserver $NFV_OCF_DIR/vim-webserver
|
|
|
|
sudo install -d -m 755 $NFV_CONF_DIR/vim/
|
|
sudo install -p -D -m 644 $NFV_VIM_DIR/nfv_vim/config.ini $NFV_CONF_DIR/vim/config.ini
|
|
sudo install -p -D -m 644 $NFV_VIM_DIR/nfv_vim/debug.ini $NFV_CONF_DIR/vim/debug.ini
|
|
}
|
|
|
|
function install_nova_api_proxy {
|
|
pushd $NOVA_API_PROXY_DIR
|
|
python setup.py build
|
|
sudo python setup.py install --root=/ --install-lib=${PYTHON_SITE_DIR} --single-version-externally-managed
|
|
popd
|
|
|
|
sudo install -d -m 755 $NOVA_API_PROXY_CONF
|
|
sudo install -p -D -m 744 $NOVA_API_PROXY_DIR/nova_api_proxy/nova-api-proxy.conf $NOVA_API_PROXY_CONF/nova-api-proxy.conf
|
|
sudo install -p -D -m 744 $NOVA_API_PROXY_DIR/nova_api_proxy/api-proxy-paste.ini $NOVA_API_PROXY_CONF/api-proxy-paste.ini
|
|
}
|
|
|
|
function start_guest_agent {
|
|
run_process guest-agent "$STXNFV_SYSCONFDIR/init.d/guestAgent start" root root
|
|
}
|
|
|
|
function start_host_agent {
|
|
run_process host-agent "$STXNFV_SYSCONFDIR/init.d/host_agent start" root root
|
|
}
|
|
|
|
function start_guest_server {
|
|
run_process guest-server "$STXNFV_SYSCONFDIR/init.d/guestServer start" root root
|
|
}
|
|
|
|
function start_nfv {
|
|
if is_service_enabled nfv-vim; then
|
|
start_nfv_vim
|
|
fi
|
|
if is_service_enabled nfv-vim-api; then
|
|
start_nfv_vim_api
|
|
fi
|
|
if is_service_enabled nfv-vim-webserver; then
|
|
start_nfv_vim_webserver
|
|
fi
|
|
|
|
if is_service_enabled nova-api-proxy; then
|
|
start_nova_api_proxy
|
|
fi
|
|
|
|
if is_service_enabled guest-agent; then
|
|
start_guest_agent
|
|
fi
|
|
if is_service_enabled guest-server; then
|
|
start_guest_server
|
|
fi
|
|
if is_service_enabled host-agent; then
|
|
start_host_agent
|
|
fi
|
|
}
|
|
|
|
function start_nfv_vim {
|
|
run_process nfv-vim "$NFV_OCF_DIR/vim start" root root
|
|
}
|
|
|
|
function start_nfv_vim_api {
|
|
run_process nfv-vim-api "$NFV_OCF_DIR/vim-api start" root root
|
|
}
|
|
|
|
function start_nfv_vim_webserver {
|
|
run_process nfv-vim-webserver "$NFV_OCF_DIR/vim-webserver start" root root
|
|
}
|
|
|
|
function start_nova_api_proxy {
|
|
local daemon
|
|
daemon=$(which nova-api-proxy)
|
|
run_process nova-api-proxy "$daemon --config-file=$NOVA_API_PROXY_CONF/nova-api-proxy.conf" root root
|
|
}
|
|
|
|
function stop_guest_agent {
|
|
stop_process guest-agent
|
|
}
|
|
|
|
function stop_guest_server {
|
|
stop_process guest-server
|
|
}
|
|
|
|
function stop_host_agent {
|
|
stop_process host-agent
|
|
}
|
|
|
|
function stop_nfv {
|
|
if is_service_enabled nfv-vim; then
|
|
stop_nfv_vim
|
|
fi
|
|
if is_service_enabled nfv-vim-api; then
|
|
stop_nfv_vim_api
|
|
fi
|
|
if is_service_enabled nfv-vim-webserver; then
|
|
stop_nfv_vim_webserver
|
|
fi
|
|
|
|
if is_service_enabled nova-api-proxy; then
|
|
stop_nova_api_proxy
|
|
fi
|
|
|
|
if is_service_enabled guest-agent; then
|
|
stop_guest_agent
|
|
fi
|
|
if is_service_enabled guest-server; then
|
|
stop_guest_server
|
|
fi
|
|
|
|
if is_service_enabled host-agent; then
|
|
stop_host_agent
|
|
fi
|
|
}
|
|
|
|
function stop_nfv_vim {
|
|
stop_process nfv-vim
|
|
}
|
|
|
|
function stop_nfv_vim_api {
|
|
stop_process nfv-vim-api
|
|
}
|
|
|
|
function stop_nfv_vim_webserver {
|
|
stop_process nfv-vim-webserver
|
|
}
|
|
|
|
function stop_nova_api_proxy {
|
|
stop_process nova-api-proxy
|
|
}
|
|
|
|
$_XTRACE_STX_NFV
|