Commit 34eac481 by Zuul Committed by Gerrit Code Review

Merge "Devstack enablement for OPAE FPGA driver."

parents 47623188 e4264635
#!/bin/bash
#
# lib/opae
# Functions to download, install, or remove OPAE packages
# Dependencies:
#
# ensure we don't re-source this in the same environment
[[ -z "$_OPAE_PKG_FNS" ]] || return 0
declare -r -g _OPAE_PKG_FNS=1
function setup_distro_vars {
PKG_EXT=""
if is_fedora; then
PKG_EXT="rpm"
elif is_ubuntu ; then
# NOTE(Sundar): OPAE packages depend on libjson0, which is
# not available after Ubuntu 16.04. After OPAE packages are
# updated, this check can be removed.
[[ $os_RELEASE == "16.04" ]] && PKG_EXT="deb"
fi
}
setup_distro_vars
function install_opae_pkg {
local pkg=$1
local url=$2
local CURL="curl -sSfL --retry 2"
local tmpfile="/tmp/$pkg.$PKG_EXT"
local retval=0
# NOTE(Sundar): After OPAE libraries become part of the distro
# repos, we can skip the download with curl.
if ! is_package_installed $pkg; then
$CURL -o $tmpfile $url; retval=$?
if [[ $? -eq 0 ]]; then
install_package $tmpfile; retval=$?
[[ $? -ne 0 ]] && echo "WARNING: Could not install $pkg"
else
echo "WARNING: Could not download $url"
fi
/bin/rm -f $tmpfile
fi
return $retval
}
function install_opae_packages {
local libs_url="$OPAE_GITHUB/$OPAE_LIBS.$PKG_EXT"
local devel_url="$OPAE_GITHUB/$OPAE_DEVEL.$PKG_EXT"
[[ "$PKG_EXT" == "" ]] && return 1
install_opae_pkg "$OPAE_LIBS_PKG" $libs_url && \
install_opae_pkg "$OPAE_DEVEL_PKG" $devel_url
# return value is the exit code of last command
}
function uninstall_opae_packages {
uninstall_package "$OPAE_DEVEL_PKG"
uninstall_package "$OPAE_LIBS_PKG"
}
......@@ -6,46 +6,49 @@
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" == "install" ]]; then
if [[ "$2" == "pre-install" ]]; then
# stack/pre-install - Called after (OS) setup is complete and before
# project source is installed
echo_summary "Installing additional Cyborg packages"
if install_opae_packages; then
echo_summary "INFO: Additional Cyborg packages installed"
else
echo "WARNING: Failed to install additional Cyborg packages"
fi
elif [[ "$2" == "install" ]]; 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
install_cyborg
elif [[ "$2" == "post-config" ]]; then
# stack/post-config - Called after the layer 1 and 2 services have been
# configured. All configuration files for enabled services should exist
# at this point.
echo_summary "Configuring Cyborg"
configure_cyborg
create_cyborg_accounts
elif [[ "$2" == "extra" ]]; then
# stack/extra - Called near the end after layer 1 and 2 services have
# been started.
# Initialize cyborg
init_cyborg
# Start the cyborg API and cyborg taskmgr components
echo_summary "Starting Cyborg"
start_cyborg
fi
fi
if [[ "$1" == "unstack" ]]; then
# unstack - Called by unstack.sh before other services are shut down.
stop_cyborg
fi
......@@ -53,6 +56,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
uninstall_opae_packages
fi
fi
enable_service cyborg cyborg-api cyborg-cond cyborg-agent
# OPAE settings
# OPAE packages are not yet upstreamed into OS repos
# We need to download them from OPAE releases page on GitHub
OPAE_VERSION=${OPAE_VERSION:-"1.1.0-2"}
OPAE_GITHUB=${OPAE_GITHUB:-"https://github.com/OPAE/opae-sdk/releases/download/$OPAE_VERSION"}
OPAE_DEVEL_PKG=${OPAE_DEVEL_PKG:-"opae-devel"}
OPAE_DEVEL=${OPAE_DEVEL:-"${OPAE_DEVEL_PKG}-$OPAE_VERSION.x86_64"}
OPAE_LIBS_PKG=${OPAE_LIBS_PKG:-"opae-libs"}
OPAE_LIBS=${OPAE_LIBS:-"${OPAE_LIBS_PKG}-$OPAE_VERSION.x86_64"}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment