Switch devstack installation to devstack-plugin

extras.d will be deprecated sometime in the mitaka
timeframe, switch the devstack install to a plugin.

Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short 2015-11-06 08:36:37 -05:00
parent dfacac48e1
commit 5e04c14881
10 changed files with 146 additions and 157 deletions

View File

@ -1,13 +0,0 @@
contrib/devstack/ directory contains the files necessary to integrate the LXD driver with devstack.
To install:
git clone https://github.com/lxc/nova-compute-lxd /opt/stack/nova-compute-lxd
git clone https://github.com/openstack-dev/devstack /opt/stack/devstack
cd /opt/stack/nova-compute-lxd
contrib/devstack/prepare_devstack.sh
To run:
cd /opt/stack/devstack
./stack.sh

View File

@ -1,29 +0,0 @@
# lxd.sh - Devstack extras script to install lxd
if [[ $VIRT_DRIVER == "lxd" ]] ; then
if [[ $1 == "source" ]] ; then
# Keep track of the current directory
SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$SCRIPT_DIR
echo $SCRIPT_DIR $TOP_DIR
# Import common functions
source $TOP_DIR/functions
# Load local configuration
source $TOP_DIR/stackrc
FILES=$TOP_DIR/files
# Get our defaults
source $TOP_DIR/lib/nova_plugins/hypervisor-lxd
source $TOP_DIR/lib/lxd
elif [[ $2 == "install" ]] ; then
echo_summary "Configuring LXD"
configure_lxd
install_lxd
fi
fi

View File

@ -1,35 +0,0 @@
# lib/lxd
# Dependencies:
# ``functions`` file
# ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
# ``stack.sh`` calls the entry points in this order:
# install_flex
XTRACE=$(set +o | grep xtrace)
set +o xtrace
PYLXD_REPO=${LXC_REPO:-git://github.com/lxc/pylxd}
PYLXD_DIR=$DEST/pylxd
LXD_DIR=${FLEX_DIR:-${DEST}/nova-compute-lxd}
function configure_lxd {
install_package python-software-properties
apt_get update
sudo apt-add-repository -y ppa:ubuntu-lxc/lxd-stable
apt_get update
install_package lxd
}
function install_lxd {
git_clone $PYLXD_REPO $PYLXD_DIR
setup_develop $PYLXD_DIR
setup_develop $LXD_DIR
mkdir -p /etc/nova/rootwrap.d
sudo cp $LXD_DIR/etc/nova/rootwrap.d/* /etc/nova/rootwrap.d
}

View File

@ -1,64 +0,0 @@
# lib/nova_plugins/hypervisor-lxd
# Configure the lxd hypervisor
# Enable with:
# VIRT_DRIVER=lxd
# Dependencies:
# ``functions`` file
# ``nova`` configuration
# install_nova_hypervisor - install any external requirements
# configure_nova_hypervisor - make configuration changes, including those to other services
# start_nova_hypervisor - start any external services
# stop_nova_hypervisor - stop any external services
# cleanup_nova_hypervisor - remove transient data and cache
# Save trace setting
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Defaults
# --------
# Entry Points
# ------------
# clean_nova_hypervisor - Clean up an installation
function cleanup_nova_hypervisor {
# This function intentionally left blank
:
}
# configure_nova_hypervisor - Set config files, create data dirs, etc
function configure_nova_hypervisor {
iniset $NOVA_CONF DEFAULT compute_driver nclxd.nova.virt.lxd.LXDDriver
}
# install_nova_hypervisor() - Install external components
function install_nova_hypervisor {
# This function intentionally left blank
:
}
# start_nova_hypervisor - Start any required external services
function start_nova_hypervisor {
# This function intentionally left blank
:
}
# stop_nova_hypervisor - Stop any external services
function stop_nova_hypervisor {
# This function intentionally left blank
:
}
# Restore xtrace
$MY_XTRACE
# Local variables:
# mode: shell-script
# End:

View File

@ -1,16 +0,0 @@
#!/bin/bash
set -xe
env
NOVALXDDIR=$(readlink -f $(dirname $0)/../..)
INSTALLDIR=${INSTALLDIR:-/opt/stack}
cp $NOVALXDDIR/contrib/devstack/extras.d/70-lxd.sh $INSTALLDIR/devstack/extras.d
cp $NOVALXDDIR/contrib/devstack/lib/nova_plugins/hypervisor-lxd $INSTALLDIR/devstack/lib/nova_plugins/
cp $NOVALXDDIR/contrib/devstack/lib/lxd $INSTALLDIR/devstack/lib/lxd
cat - <<-EOF >> $INSTALLDIR/devstack/localrc
VIRT_DRIVER=lxd
export NON_STANDARD_REQS=1
EOF

15
devstack/README.rst Normal file
View File

@ -0,0 +1,15 @@
====================
Enabling in 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-compute-lxd https://github.com/lxc/nova-compute-lxd
3. run stack.sh

View File

@ -0,0 +1,35 @@
#!/bin/bash
# devstack/powervm-functions.sh
# Functions to control the installation and configuration of the PowerVM
# compute services
GITREPO["pylxd"]=${PYLXD_REPO:-https://github.com/lxc/pylxd}
GITBRANCH["pylxd"]=${PYLXD_BRANCH:-master}
GITDIR["pylxd"]=$DEST/pylxd
function install_pylxd {
# Install the latest pylxd from git
echo_summary "Installing pylxd"
git_clone_by_name pylxd
setup_dev_lib "pylxd"
echo_summary "Pylxd install complete"
}
function cleanup_pylxd {
echo_summary "Cleaning pylxd"
rm -rf ${GITDIR["pylxd"]}
}
function install_lxd {
echo_summary "Checing LXD installation"
if is_ubuntu; then
if ! ( is_package_installed lxd ); then
install_packge lxd
fi
add_user_to_group $STACK_USER $LXD_GROUP
fi
echo_summary "Installing LXD"
}

View File

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

87
devstack/plugin.sh Executable file
View File

@ -0,0 +1,87 @@
#!/bin/bash
# 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_COMPUTE_LXD_DIR=${NOVA_POWERVM_DIR:-${DEST}/nova-compute-lxd}
NOVA_COMPUTE_LXD_PLUGIN_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
source $NOVA_COMPUTE_LXD_PLUGIN_DIR/nova-lxd-functions.sh
function pre_install_nova-compute-lxd() {
# Install OS packages if necessary with "install_package ...".
install_lxd
install_pylxd
}
function install_nova-compute-lxd() {
# Install the service.
setup_develop $NOVA_COMPUTE_LXD_DIR
}
function configure_nova-compute-lxd() {
# Configure the service.
iniset $NOVA_CONF DEFAULT compute_driver nclxd.nova.virt.lxd.LXDDriver
}
function init_nova-compute-lxd() {
# Initialize and start the service.
:
}
function shutdown_nova-compute-lxd() {
# Shut the service down.
:
}
function cleanup_nova-compute-lxd() {
# Cleanup the service.
:
}
if is_service_enabled nova-compute-lxd; then
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
# Set up system services
echo_summary "Configuring system services nova-compute-lxd"
pre_install_nova-compute-lxd
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
# Perform installation of service source
echo_summary "Installing nova-compute-lxd"
install_nova-compute-lxd
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
echo_summary "Configuring nova-compute-lxd"
configure_nova-compute-lxd
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize and start the nova-compute-lxd service
echo_summary "Initializing nova-compute-lxd"
init_nova-compute-lxd
fi
if [[ "$1" == "unstack" ]]; then
# Shut down nova-compute-lxd services
# no-op
shutdown_nova-compute-lxd
fi
if [[ "$1" == "clean" ]]; then
# Remove state and transient data
# Remember clean.sh first calls unstack.sh
# no-op
cleanup_nova-compute-lxd
fi
fi

6
devstack/settings Normal file
View File

@ -0,0 +1,6 @@
# Add nova-lxd to enabled services
enable_service nova-compute-lxd
# LXD install/upgrade settings
INTSALL_LXD=${INSTALL_LXD:-False}
LXD_GROUP=${LXD_GROUP:lxd}