Add base devstack plugins support

Add support for installing nova powervm through the devstack plugins
infrastructure. This allows you to simply enable the plugin in a
devstack localrc, provide any non-default config, and run stack.sh
to configure/install it.
- Added plugin files
- Added README and example config
- Added bashate to tox test environments for scripts

Change-Id: I3dfed189e60b0aa63fc9029e3f56f2d8b7785bd3
This commit is contained in:
Adam Reznechek 2015-10-22 13:48:21 -04:00
parent b8eb410f84
commit ecc4100bf1
8 changed files with 318 additions and 0 deletions

37
devstack/README.rst Normal file
View File

@ -0,0 +1,37 @@
========================
Installing with Devstack
========================
1. Download DevStack::
$ git clone https://git.openstack.org/openstack-dev/devstack /opt/stack/devstack
2. Modify DevStack's local.conf to pull in this project by adding::
[[local|localrc]]
enable_plugin nova-powervm http://git.openstack.org/openstack/nova-powervm
2a. See the file "local.conf.example" in nova-powervm/devstack for reference
on using this driver with the corresponding networking-powervm and
ceilometer-powervm drivers. Following the example file will enable all
three plugins, resulting an all-in-one powervm devstack node.
3. See nova-powervm/doc/source/devref/usage.rst, review the configuration options,
then configure the installation in local.conf as needed for your environment.
Besides DISK_DRIVER, the default config will be sufficient for most installs. ::
[[local|localrc]]
...
DISK_DRIVER =
VOL_GRP_NAME =
CLUSTER_NAME =
[[post-config|$NOVA_CONF]]
[powervm]
...
4. Run ``stack.sh`` from devstack::
$ cd /opt/stack/devstack
$ ./stack.sh

View File

@ -0,0 +1,38 @@
[[local|localrc]]
LOGFILE=/opt/stack/logs/stack.sh.log
SCREEN_LOGDIR=~/screen_log/
LOGDAYS=1
ADMIN_PASSWORD=admin
MYSQL_PASSWORD=mysql
RABBIT_PASSWORD=rabbit
SERVICE_PASSWORD=admin
SERVICE_TOKEN=service
HOST_NAME=$(hostname)
SERVICE_HOST_NAME=${HOST_NAME}
SERVICE_HOST=$HOST_NAME
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
KEYSTONE_AUTH_HOST=$SERVICE_HOST
KEYSTONE_SERVICE_HOST=$SERVICE_HOST
VNCSERVER_PROXYCLIENT_ADDRESS=$SERVICE_HOST
VNCSERVER_LISTEN=0.0.0.0
Q_PLUGIN=ml2
Q_ML2_TENANT_NETWORK_TYPE=vlan
Q_ML2_PLUGIN_TYPE_DRIVERS=vlan
ENABLE_TENANT_VLANS=True
PHYSICAL_NETWORK=default
DISK_DRIVER=localdisk
VOL_GRP_NAME=devstackvg
# Enable plugins
enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer.git
enable_plugin nova-powervm https://git.openstack.org/openstack/nova-powervm.git
enable_plugin networking-powervm https://git.openstack.org/openstack/networking-powervm.git
enable_plugin ceilometer-powervm https://git.openstack.org/openstack/ceilometer-powervm.git

View File

@ -0,0 +1,3 @@
# Plug-in overrides
VIRT_DRIVER=powervm

151
devstack/plugin.sh Executable file
View File

@ -0,0 +1,151 @@
#!/bin/bash
#
# plugin.sh - Devstack extras script to install and configure the nova compute
# driver for powervm
# This driver is enabled in override-defaults with:
# VIRT_DRIVER=${VIRT_DRIVER:-powervm}
# The following entry points are called in this order for nova-powervm:
#
# - install_nova_powervm
# - configure_nova_powervm
# - start_nova_powervm
# - stop_nova_powervm
# - cleanup_nova_powervm
# Save trace setting
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Defaults
# --------
# Set up base directories
NOVA_DIR=${NOVA_DIR:-$DEST/nova}
NOVA_CONF_DIR=${NOVA_CONF_DIR:-/etc/nova}
NOVA_CONF=${NOVA_CONF:-NOVA_CONF_DIR/nova.conf}
# nova-powervm directories
NOVA_POWERVM_DIR=${NOVA_POWERVM_DIR:-${DEST}/nova-powervm}
NOVA_POWERVM_PLUGIN_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
# Support entry points installation of console scripts
if [[ -d $NOVA_DIR/bin ]]; then
NOVA_BIN_DIR=$NOVA_DIR/bin
else
NOVA_BIN_DIR=$(get_python_exec_prefix)
fi
# Source functions
source $NOVA_POWERVM_PLUGIN_DIR/powervm-functions.sh
# Entry Points
# ------------
# configure_nova_powervm() - Configure the system to use nova_powervm
function configure_nova_powervm {
# Default configuration
iniset $NOVA_CONF DEFAULT compute_driver $PVM_DRIVER
iniset $NOVA_CONF DEFAULT instance_name_template $INSTANCE_NAME_TEMPLATE
iniset $NOVA_CONF DEFAULT compute_available_monitors $COMPUTE_MONITORS
iniset $NOVA_CONF DEFAULT compute_monitors ComputeDriverCPUMonitor
iniset $NOVA_CONF DEFAULT force_config_drive $FORCE_CONFIG_DRIVE
iniset $NOVA_CONF DEFAULT injected_network_template $INJECTED_NETWORK_TEMPLATE
iniset $NOVA_CONF DEFAULT flat_injected $FLAT_INJECTED
iniset $NOVA_CONF DEFAULT use_ipv6 $USE_IPV6
iniset $NOVA_CONF DEFAULT firewall_driver $FIREWALL_DRIVER
# PowerVM specific configuration
iniset $NOVA_CONF powervm disk_driver $DISK_DRIVER
if [[ -n $VOL_GRP_NAME ]]; then
iniset $NOVA_CONF powervm volume_group_name $VOL_GRP_NAME
fi
if [[ -n $CLUSTER_NAME ]]; then
iniset $NOVA_CONF powervm cluster_name $CLUSTER_NAME
fi
}
# install_nova_powervm() - Install nova_powervm and necessary dependencies
function install_nova_powervm {
install_pypowervm
# Install the nova-powervm package
setup_develop $NOVA_POWERVM_DIR
}
# start_nova_powervm() - Start the nova_powervm process
function start_nova_powervm {
# Check that NovaLink is installed and running
check_novalink_install
# This function intentionally functionless as the
# compute service will start normally
}
# stop_nova_powervm() - Stop the nova_powervm process
function stop_nova_powervm {
# This function intentionally left blank as the
# compute service will stop normally
:
}
# cleanup_nova_powervm() - Cleanup the nova_powervm process
function cleanup_nova_powervm {
# This function intentionally left blank
:
}
# Core Dispatch
# -------------
if is_service_enabled nova-powervm; then
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
# Install NovaLink if set
if [[ "$INSTALL_NOVALINK" == "True" ]]; then
echo_summary "Installing NovaLink"
install_novalink
fi
echo_summary "Configuring nova-powervm compute services"
# Configure controller services
enable_service n-novnc
fi
if [[ "$1" == "stack" && "$2" == "install" ]]; then
# Perform installation of nova-powervm
echo_summary "Installing nova-powervm"
install_nova_powervm
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Lay down configuration post install
echo_summary "Configuring nova-powervm"
configure_nova_powervm
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize and start the nova-powervm/nova-compute service
echo_summary "Starting nova-powervm"
start_nova_powervm
fi
if [[ "$1" == "unstack" ]]; then
# Shut down nova-powervm/nova-compute
echo_summary "Stopping nova-powervm"
stop_nova_powervm
fi
if [[ "$1" == "clean" ]]; then
# Remove any lingering configuration data
# clean.sh first calls unstack.sh
echo_summary "Cleaning up nova-powervm and associated data"
cleanup_nova_powervm
cleanup_pypowervm
fi
fi
# Restore xtrace
$MY_XTRACE
# Local variables:
# mode: shell-script
# End:

View File

@ -0,0 +1,55 @@
#!/bin/bash
# devstack/powervm-functions.sh
# Functions to control the installation and configuration of the PowerVM compute services
GITREPO["pypowervm"]=${PYPOWERVM_REPO:-https://github.com/pypowervm/pypowervm}
GITBRANCH["pypowervm"]=${PYPOWERVM_BRANCH:-master}
GITDIR["pypowervm"]=$DEST/pypowervm
# TODO (adreznec) Uncomment when public NovaLink PPA available
# NOVALINK_PPA=${NOVALINK_PPA:-TBD}
function install_pypowervm {
# Install the latest pypowervm from git
echo_summary "Installing pypowervm"
git_clone_by_name "pypowervm"
setup_dev_lib "pypowervm"
echo_summary "Pypowervm install complete"
}
function cleanup_pypowervm {
echo_summary "Cleaning pypowervm"
rm -rf ${GITDIR["pypowervm"]}
}
function check_novalink_install {
echo_summary "Checking NovaLink installation"
if ! ( is_package_installed pvm-novalink ); then
die $LINENO "Please install NovaLink before continuing"
fi
# The user that nova runs as should be a member of **pvm_admin** group
if ! getent group $PVM_ADMIN_GROUP >/dev/null; then
sudo groupadd $PVM_ADMIN_GROUP
fi
add_user_to_group $STACK_USER $PVM_ADMIN_GROUP
}
function install_novalink {
echo_summary "Installing NovaLink"
if is_ubuntu; then
# Set up the NovaLink PPA
# TODO (adreznec) Uncomment when public NovaLink PPA available
# echo "deb ${NOVALINK_PPA} ${DISTRO} main" | sudo tee /etc/apt/sources.list.d/novalink-${DISTRO}.list
# echo "deb-src ${NOVALINK_PPA} ${DISTRO} main" | sudo tee --append /etc/apt/sources.list.d/novalink-${DISTRO}.list
NO_UPDATE_REPOS=FALSE
REPOS_UPDATED=FALSE
else
die $LINENO "NovaLink is currently supported only on Ubuntu platforms"
fi
install_package pvm-novalink
echo_summary "NovaLink install complete"
}

28
devstack/settings Normal file
View File

@ -0,0 +1,28 @@
# Devstack settings
# These defaults can be overridden in the localrc section of the local.conf file
# Add nova-powervm to enabled services
enable_service nova-powervm
# NovaLink install/upgrade settings
INSTALL_NOVALINK=${INSTALL_NOVALINK:-False}
PVM_ADMIN_GROUP=${PVM_ADMIN_GROUP:-pvm_admin}
# Nova settings
PVM_DRIVER=nova_powervm.virt.powervm.driver.PowerVMDriver
INSTANCE_NAME_TEMPLATE=${INSTANCE_NAME_TEMPLATE:-"%(display_name).13s-%(uuid).8s-pvm-devstack"}
COMPUTE_MONITORS=${COMPUTE_MONITORS:-nova.compute.monitors.all_monitors}
FORCE_CONFIG_DRIVE=${FORCE_CONFIG_DRIVE:-True}
INJECTED_NETWORK_TEMPLATE=${INJECTED_NETWORK_TEMPLATE:-$DEST/nova/nova/virt/interfaces.template}
FLAT_INJECTED=${FLAT_INJECTED:-true}
# This is required to be true to support the PowerVM RMC management network
USE_IPV6=${USE_IPV6:-True}
FIREWALL_DRIVER=${FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"}
# PowerVM settings
# DISK_DRIVER : 'localdisk' (the default) or 'ssp'
DISK_DRIVER=${DISK_DRIVER:-ssp}
# VOL_GRP_NAME only required for localdisk driver
# VOL_GRP_NAME=${VOL_GRP_NAME:-devstackvg}
# CLUSTER_NAME used by SSP driver
# CLUSTER_NAME=${CLUSTER_NAME:-devstack_cluster}

View File

@ -1,5 +1,6 @@
hacking>=0.10.0,<0.11
bashate>=0.3.1
coverage>=3.6
discover
fixtures>=1.3.1

View File

@ -26,6 +26,11 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:bashate]
commands =
bash -c "ls devstack/*.sh | xargs bashate -v {posargs}"
whitelist_externals = bash
[flake8]
ignore = E125,E712,H104,H405,H904
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools