bug fix: deploy every cyborg components correctly

Different components need different config.

Change-Id: Id73cd0dd7eb2abc2d411cc3d5abbbd4e3df58f0f
This commit is contained in:
Shaohe Feng 2019-05-15 12:43:12 +00:00 committed by ShaoHe Feng
parent 179bcd1711
commit 34f8c6a147
3 changed files with 108 additions and 40 deletions

View File

@ -62,17 +62,22 @@ else
CYBORG_API_URL="$CYBORG_SERVICE_PROTOCOL://$CYBORG_SERVICE_HOST:$CYBORG_SERVICE_PORT" CYBORG_API_URL="$CYBORG_SERVICE_PROTOCOL://$CYBORG_SERVICE_HOST:$CYBORG_SERVICE_PORT"
fi fi
function install_cyborg_in_controller {
if is_service_enabled cyborg-api; then
local req_services="key"
req_services+=" placement"
for srv in $req_services; do
if ! is_service_enabled "$srv"; then
die $LINENO "$srv should be enabled for Cyborg."
fi
done
fi
}
# install_cyborg() - Install the things! # install_cyborg() - Install the things!
function install_cyborg { function install_cyborg {
# make sure all needed service were enabled # make sure all needed services are enabled
local req_services="key" install_cyborg_in_controller
req_services+=" nova glance neutron"
for srv in $req_services; do
if ! is_service_enabled "$srv"; then
die $LINENO "$srv should be enabled for Cyborg."
fi
done
setup_develop $CYBORG_DIR setup_develop $CYBORG_DIR
} }
@ -116,13 +121,15 @@ function configure_cyborg_dirs {
# ------------------------------ # ------------------------------
# service cyborg admin # service cyborg admin
function create_cyborg_accounts { function create_cyborg_accounts {
create_service_user "cyborg" "admin" if is_service_enabled cyborg-api; then
get_or_create_service "cyborg" "accelerator" "Cyborg Accelerators Service" create_service_user "cyborg" "admin"
get_or_create_endpoint "cyborg" \ get_or_create_service "cyborg" "accelerator" "Cyborg Accelerators Service"
"$REGION_NAME" \ get_or_create_endpoint "cyborg" \
"$CYBORG_API_URL/v1" \ "$REGION_NAME" \
"$CYBORG_API_URL/v1" \ "$CYBORG_API_URL/v1" \
"$CYBORG_API_URL/v1" "$CYBORG_API_URL/v1" \
"$CYBORG_API_URL/v1"
fi
} }
@ -261,12 +268,14 @@ function create_cyborg_cache_dir {
# init_cyborg() - Initialize databases, etc. # init_cyborg() - Initialize databases, etc.
function init_cyborg { function init_cyborg {
# (re)create Cyborg database if is_service_enabled cyborg-api; then
recreate_database cyborg utf8 # (re)create Cyborg database
recreate_database cyborg utf8
# Migrate cyborg database # Migrate cyborg database
$CYBORG_BIN_DIR/cyborg-dbsync --config-file ${CYBORG_CONF_FILE} upgrade $CYBORG_BIN_DIR/cyborg-dbsync --config-file ${CYBORG_CONF_FILE} upgrade
create_cyborg_cache_dir create_cyborg_cache_dir
fi
} }

View File

@ -8,28 +8,52 @@ echo_summary "cyborg devstack plugin.sh called: $1/$2"
source $DEST/cyborg/devstack/lib/cyborg source $DEST/cyborg/devstack/lib/cyborg
source $DEST/cyborg/devstack/lib/opae source $DEST/cyborg/devstack/lib/opae
if is_service_enabled cyborg-api cyborg-cond; then
if [[ "$1" == "stack" ]]; then function pre_install_agent {
if [[ "$2" == "pre-install" ]]; then if is_service_enabled cyborg-agent; then
# stack/pre-install - Called after (OS) setup is complete and before # stack/pre-install - Called after (OS) setup is complete and before
# project source is installed # project source is installed
echo_summary "Installing additional Cyborg packages" echo_summary "Installing additional Cyborg packages"
if [[ "$OPAE_INSTALL_ENABLE" == "True" ]] && install_opae_packages; then if [[ "$OPAE_INSTALL_ENABLE" == "True" ]] && install_opae_packages; then
echo_summary "INFO: Additional Cyborg packages installed" echo_summary "INFO: Additional Cyborg packages installed"
elif [[ "$OPAE_INSTALL_ENABLE" == "True" ]]; then elif [[ "$OPAE_INSTALL_ENABLE" == "True" ]]; then
echo "WARNING: Failed to install additional Cyborg packages" echo "WARNING: Failed to install additional Cyborg packages"
fi fi
elif [[ "$2" == "install" ]]; then fi
}
function install_agent {
if is_service_enabled cyborg-agent; then
# stack/install - Called after the layer 1 and 2 projects source and # stack/install - Called after the layer 1 and 2 projects source and
# their dependencies have been installed # their dependencies have been installed
echo_summary "Installing Cyborg" echo_summary "Installing Cyborg"
if ! is_service_enabled nova; then if ! is_service_enabled n-cpu; then
source $RC_DIR/lib/nova_plugins/functions-libvirt source $RC_DIR/lib/nova_plugins/functions-libvirt
install_libvirt install_libvirt
fi fi
fi
}
function cleanup_agent {
if is_service_enabled cyborg-agent; then
if [[ "$OPAE_INSTALL_ENABLE" == "True" ]]; then
uninstall_opae_packages
fi
fi
}
if is_service_enabled cyborg-api cyborg-cond || is_service_enabled cyborg-agent; then
if [[ "$1" == "stack" ]]; then
if [[ "$2" == "pre-install" ]]; then
pre_install_agent
elif [[ "$2" == "install" ]]; then
install_agent
install_cyborg install_cyborg
elif [[ "$2" == "post-config" ]]; then elif [[ "$2" == "post-config" ]]; then
# stack/post-config - Called after the layer 1 and 2 services have been # stack/post-config - Called after the layer 0 and 2 services have been
# configured. All configuration files for enabled services should exist # configured. All configuration files for enabled services should exist
# at this point. # at this point.
echo_summary "Configuring Cyborg" echo_summary "Configuring Cyborg"
@ -56,8 +80,6 @@ if is_service_enabled cyborg-api cyborg-cond; then
# clean - Called by clean.sh before other services are cleaned, but after # clean - Called by clean.sh before other services are cleaned, but after
# unstack.sh has been called. # unstack.sh has been called.
cleanup_cyborg cleanup_cyborg
if [[ "$OPAE_INSTALL_ENABLE" == "True" ]]; then cleanup_agent
uninstall_opae_packages
fi
fi fi
fi fi

View File

@ -142,6 +142,35 @@ Disable OPAE install
If you do not want to try Intel FPGA, you can disable OPAE install. Then you If you do not want to try Intel FPGA, you can disable OPAE install. Then you
do not depend on specific OS verson. do not depend on specific OS verson.
Multi-Node Lab
--------------
If you want to setup an OpenStack with cyborg in a realistic test configuration
with multiple physical servers. Please ref [#MultiNodeLab]_.
Cluster Controller
>>>>>>>>>>>>>>>>>>
::
disable_service cyborg-agent
Compute Nodes
>>>>>>>>>>>>>
::
enable_service cyborg-agent
disable_service cyborg-api
disable_service cyborg-cond
- If you do not want to setup cyborg-agent on controller, you can disable it.
- You do not need to enable cyborg-api and cyborg-cond on compute nodes.
Cell V2 Deployment
>>>>>>>>>>>>>>>>>>
Compute node services must be mapped to a cell before they can be used.
Cell V2 deployment, please ref [#CellV2]_.
Run DevStack Run DevStack
------------ ------------
@ -170,3 +199,11 @@ Horizon
You can access horizon to experience the web interface to OpenStack, and manage You can access horizon to experience the web interface to OpenStack, and manage
vms, networks, volumes, and images from there. vms, networks, volumes, and images from there.
References
==========
.. [#MultiNodeLab] `Openstack Multi-Node Lab Setup
<https://docs.openstack.org/devstack/latest/guides/multinode-lab.html>`_
.. [#CellV2] `Openstack Cell V2 Deployment Guide
<https://docs.openstack.org/nova/latest/user/cells.html>`_