Add devstack plugin

This is initial commit of ironic-staging-drivers devstack plugin.
The plugin install ironic-staging-drivers and adds drivers specified
in devstack/enabled-drivers.txt to Ironic enabled_drivers.

It install driver specific requirements by walking through list of
staging drivers directories and calls:
  pip_install -r $driver/python-requirements.txt
  source $driver/other-requirements.sh

Directories specified in IRONIC_DRIVERS_EXCLUDED_DIRS are ignored.

List of enabled ironic drivers:
 fake_wol_fake, pxe_wol_iscsi, pxe_wol_agent,
 agent_ipmitool_nm, fake_nm,
 pxe_libvirt_agent, pxe_libvirt_iscsi, fake_libvirt_fake

Moves libvirt requirements to libvirt/python-requirements.txt

amt driver requires openwsman library, and will be added in next CR.

Change-Id: I281118b6e4bf17c98717d7727f99e61db418ba20
This commit is contained in:
Vasyl Saienko 2016-03-29 05:21:36 -04:00
parent b9b780fe17
commit afee94c720
4 changed files with 73 additions and 6 deletions

View File

@ -0,0 +1,8 @@
fake_wol_fake
pxe_wol_iscsi
pxe_wol_agent
agent_ipmitool_nm
fake_nm
pxe_libvirt_agent
pxe_libvirt_iscsi
fake_libvirt_fake

64
devstack/plugin.sh Executable file
View File

@ -0,0 +1,64 @@
#!/bin/bash
# plugin.sh - devstack plugin for ironic-staging-drivers
IRONIC_STAGING_DRIVERS_DIR=$DEST/ironic-staging-drivers
IRONIC_DRIVERS_EXCLUDED_DIRS='tests common'
function update_ironic_enabled_drivers {
local saveIFS
saveIFS=$IFS
IFS=","
while read driver; do
if [[ ! $IRONIC_ENABLED_DRIVERS =~ $(echo "\<$driver\>") ]]; then
if [[ -z "$IRONIC_ENABLED_DRIVERS" ]]; then
IRONIC_ENABLED_DRIVERS="$driver"
else
IRONIC_ENABLED_DRIVERS+=",$driver"
fi
fi
done < $IRONIC_STAGING_DRIVERS_DIR/devstack/enabled-drivers.txt
IFS=$saveIFS
# NOTE(vsaienko) if ironic-staging-drivers are called after ironic
# setting IRONIC_ENABLED_DRIVERS will not take affect. Update ironic
# configuration explicitly.
iniset $IRONIC_CONF_FILE DEFAULT enabled_drivers "$IRONIC_ENABLED_DRIVERS"
}
function install_ironic_staging_drivers {
setup_develop $IRONIC_STAGING_DRIVERS_DIR
}
function install_drivers_dependencies {
local p_deps
local o_deps
for path in $IRONIC_STAGING_DRIVERS_DIR/ironic_staging_drivers/*; do
driver=$(basename $path)
if [[ -d $path && ! "$IRONIC_DRIVERS_EXCLUDED_DIRS" =~ "$driver" ]]; then
p_deps=${IRONIC_STAGING_DRIVERS_DIR}/ironic_staging_drivers/${driver}/python-requirements.txt
o_deps=${IRONIC_STAGING_DRIVERS_DIR}/ironic_staging_drivers/${driver}/other-requirements.sh
if [[ -f "$p_deps" ]]; then
echo_summary "Installing $driver python dependencies"
pip_install -r $p_deps
fi
if [[ -f "$o_deps" ]]; then
echo_summary "Installing $driver other dependencies"
source $o_deps
fi
fi
done
}
echo_summary "ironic-staging-drivers plugin.sh was called..."
if is_service_enabled ir-api ir-cond; then
if [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing Ironic-staging-drivers"
install_ironic_staging_drivers
install_drivers_dependencies
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring Ironic-staging-drivers"
update_ironic_enabled_drivers
fi
fi

View File

@ -1,6 +0,0 @@
# This file lists all python libraries which are utilized by drivers,
# and may not be listed in global-requirements.
# libvirt driver requires libvirt-python library which is available on pypi
libvirt-python>=1.2.5 # LGPLv2+

View File

@ -0,0 +1 @@
libvirt-python>=1.2.5 # LGPLv2+