From 0ae942b41c6dcd0fe7353e7d68574194fb72a66d Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 3 Jun 2015 14:09:05 +0200 Subject: [PATCH] Only install python-libguestfs bindings when needed Currently those bindings are missing from SLES12, and since they're not actually used unless file injection is enabled (which is not by default), only conditionally depend on it. Change-Id: I79a8d8ac7ad2fbd7d2fce696821d130218e43e03 --- lib/nova_plugins/functions-libvirt | 2 -- lib/nova_plugins/hypervisor-libvirt | 11 +++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/nova_plugins/functions-libvirt b/lib/nova_plugins/functions-libvirt index 96d8a44b05..22b58e0065 100755 --- a/lib/nova_plugins/functions-libvirt +++ b/lib/nova_plugins/functions-libvirt @@ -28,7 +28,6 @@ function install_libvirt { else install_package qemu-kvm install_package libguestfs0 - install_package python-guestfs fi install_package libvirt-bin libvirt-dev pip_install_gr libvirt-python @@ -37,7 +36,6 @@ function install_libvirt { install_package kvm install_package libvirt libvirt-devel pip_install_gr libvirt-python - install_package python-libguestfs fi } diff --git a/lib/nova_plugins/hypervisor-libvirt b/lib/nova_plugins/hypervisor-libvirt index a6a87f9164..f70b21a475 100644 --- a/lib/nova_plugins/hypervisor-libvirt +++ b/lib/nova_plugins/hypervisor-libvirt @@ -26,7 +26,7 @@ source $TOP_DIR/lib/nova_plugins/functions-libvirt # -------- # File injection is disabled by default in Nova. This will turn it back on. -ENABLE_FILE_INJECTION=${ENABLE_FILE_INJECTION:-False} +ENABLE_FILE_INJECTION=$(trueorfalse False ENABLE_FILE_INJECTION) # Entry Points @@ -60,7 +60,6 @@ function configure_nova_hypervisor { iniset $NOVA_CONF DEFAULT vnc_enabled "false" fi - ENABLE_FILE_INJECTION=$(trueorfalse False ENABLE_FILE_INJECTION) if [[ "$ENABLE_FILE_INJECTION" = "True" ]] ; then # When libguestfs is available for file injection, enable using # libguestfs to inspect the image and figure out the proper @@ -97,6 +96,14 @@ function install_nova_hypervisor { yum_install libcgroup-tools fi fi + + if [[ "$ENABLE_FILE_INJECTION" = "True" ]] ; then + if is_ubuntu; then + install_package python-guestfs + elif is_fedora || is_suse; then + install_package python-libguestfs + fi + fi } # start_nova_hypervisor - Start any required external services