devstack-plugin-additional-.../devstack/lib/libvirt

100 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
#
# lib/libvirt
#
# Dependencies:
# TODO: Fill this out
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Uses globals ``REQUIREMENTS_DIR``
# Uses functions ``get_from_global_requirements``
function pre_install_libvirt_ubuntu {
# NOTE(markus_z): The command "add-apt-repository" is not available
# in the test nodes. We add it here:
sudo apt-get install -y software-properties-common
# We don't use install_package as we know we're on ubuntu and we do a few
# "special" things to make the plugin "just work"
sudo add-apt-repository -y cloud-archive:liberty
sudo apt-get update
# NOTE(tonyb): This will nuke any/all libvirt config changes
sudo apt-get -o Dpkg::Options::="--force-confnew,confmiss" \
install -y \
libvirt-{bin,dev}=1.2.16-2ubuntu11.15.10.3~cloud0 \
qemu-{kvm,utils}=1:2.3+dfsg-5ubuntu9.1~cloud0
# We *need* to ensure that libvirt-python is built against the new version
# of libvirt.so.0 Bypass the cache. This is little sub-optimal becuase we
# bypass both the http and wheel caches when we really only want to bypass
# the wheel cache. Ho Hum
sudo pip install --no-cache-dir --upgrade --no-deps --force-reinstall \
-c $REQUIREMENTS_DIR/upper-constraints.txt \
$(get_from_global_requirements libvirt-python)
}
function shutdown_libvirt_ubuntu {
# NOTE(tonyb): This will nuke any/all libvirt config changes
sudo apt-get purge -y libvirt-bin libvirt-dev libvirt0 \
qemu-kvm qemu-utils qemu-system-x86 \
qemu-system-common qemu-block-extra:amd64 seabios
# This is overkill
# sudo apt-get autoremove -y
sudo add-apt-repository -y -r cloud-archive:liberty
sudo rm /etc/apt/sources.list.d/cloudarchive-liberty.list*
# Be nice to whomever folows and make sure apt-get install libvirt-bin
# will work *and* not be from UCA
sudo apt-get update
# Make sure we don't leave an almost certainly broken libvirt-python
# installed
sudo pip uninstall -y libvirt-python
# Remove the package we installed in "pre_install_libvirt_ubuntu"
sudo apt-get purge -y software-properties-common
}
function pre_install_libvirt {
if is_ubuntu; then
pre_install_libvirt_ubuntu
else
echo "libvirt isn't available for $DISTRO"
fi
}
function install_libvirt {
# Install the service.
:
}
function configure_libvirt {
# Configure the service.
:
}
function init_add_libvirt {
# Initialize and start the service.
:
}
function shutdown_libvirt {
if is_ubuntu; then
shutdown_libvirt_ubuntu
fi
}
# FIXME: Need to work on the cleanup side
function cleanup_libvirt {
# Cleanup the service.
:
}
# Restore xtrace
$XTRACE
## Local variables:
## mode: shell-script
## End: