Merge "bug fix: deploy every cyborg components correctly"

This commit is contained in:
Zuul 2019-07-11 22:56:56 +00:00 committed by Gerrit Code Review
commit 6f92643cbd
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"
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!
function install_cyborg {
# make sure all needed service were enabled
local req_services="key"
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
# make sure all needed services are enabled
install_cyborg_in_controller
setup_develop $CYBORG_DIR
}
@ -116,13 +121,15 @@ function configure_cyborg_dirs {
# ------------------------------
# service cyborg admin
function create_cyborg_accounts {
create_service_user "cyborg" "admin"
get_or_create_service "cyborg" "accelerator" "Cyborg Accelerators Service"
get_or_create_endpoint "cyborg" \
"$REGION_NAME" \
"$CYBORG_API_URL/v1" \
"$CYBORG_API_URL/v1" \
"$CYBORG_API_URL/v1"
if is_service_enabled cyborg-api; then
create_service_user "cyborg" "admin"
get_or_create_service "cyborg" "accelerator" "Cyborg Accelerators Service"
get_or_create_endpoint "cyborg" \
"$REGION_NAME" \
"$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.
function init_cyborg {
# (re)create Cyborg database
recreate_database cyborg utf8
if is_service_enabled cyborg-api; then
# (re)create Cyborg database
recreate_database cyborg utf8
# Migrate cyborg database
$CYBORG_BIN_DIR/cyborg-dbsync --config-file ${CYBORG_CONF_FILE} upgrade
create_cyborg_cache_dir
# Migrate cyborg database
$CYBORG_BIN_DIR/cyborg-dbsync --config-file ${CYBORG_CONF_FILE} upgrade
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/opae
if is_service_enabled cyborg-api cyborg-cond; then
if [[ "$1" == "stack" ]]; then
if [[ "$2" == "pre-install" ]]; then
function pre_install_agent {
if is_service_enabled cyborg-agent; then
# stack/pre-install - Called after (OS) setup is complete and before
# project source is installed
echo_summary "Installing additional Cyborg packages"
if [[ "$OPAE_INSTALL_ENABLE" == "True" ]] && install_opae_packages; then
echo_summary "INFO: Additional Cyborg packages installed"
elif [[ "$OPAE_INSTALL_ENABLE" == "True" ]]; then
echo "WARNING: Failed to install additional Cyborg packages"
fi
elif [[ "$2" == "install" ]]; then
echo_summary "Installing additional Cyborg packages"
if [[ "$OPAE_INSTALL_ENABLE" == "True" ]] && install_opae_packages; then
echo_summary "INFO: Additional Cyborg packages installed"
elif [[ "$OPAE_INSTALL_ENABLE" == "True" ]]; then
echo "WARNING: Failed to install additional Cyborg packages"
fi
fi
}
function install_agent {
if is_service_enabled cyborg-agent; then
# stack/install - Called after the layer 1 and 2 projects source and
# their dependencies have been installed
echo_summary "Installing Cyborg"
if ! is_service_enabled nova; then
source $RC_DIR/lib/nova_plugins/functions-libvirt
install_libvirt
fi
echo_summary "Installing Cyborg"
if ! is_service_enabled n-cpu; then
source $RC_DIR/lib/nova_plugins/functions-libvirt
install_libvirt
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
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
# at this point.
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
# unstack.sh has been called.
cleanup_cyborg
if [[ "$OPAE_INSTALL_ENABLE" == "True" ]]; then
uninstall_opae_packages
fi
cleanup_agent
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
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
------------
@ -170,3 +199,11 @@ Horizon
You can access horizon to experience the web interface to OpenStack, and manage
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>`_