From f28e7ef6ba48030d7bc5c6ea27f28b8a1fc281e9 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Sun, 7 May 2017 22:02:10 -0400 Subject: [PATCH] uninstall libvirt-python and reinstall libvirt-python compiles against the currently installed libvirt. If you upgrade that, it needs to rebuild, however it won't change versions, so pip install just noops. Force an uninstall / reinstall of it every time to handle potential upgrades of libvirt. Change-Id: If34541b34aa6d55eedaf6c603fd1fe92eb887308 --- inc/python | 14 ++++++++++++++ lib/nova_plugins/functions-libvirt | 3 +++ 2 files changed, 17 insertions(+) diff --git a/inc/python b/inc/python index 2443c4d465..a004217b4a 100644 --- a/inc/python +++ b/inc/python @@ -351,6 +351,20 @@ function pip_install { return $result } +function pip_uninstall { + local name=$1 + if [[ -n ${PIP_VIRTUAL_ENV:=} && -d ${PIP_VIRTUAL_ENV} ]]; then + local cmd_pip=$PIP_VIRTUAL_ENV/bin/pip + local sudo_pip="env" + else + local cmd_pip + cmd_pip=$(get_pip_command $PYTHON2_VERSION) + local sudo_pip="sudo -H" + fi + # don't error if we can't uninstall, it might not be there + $sudo_pip $cmd_pip uninstall $name || /bin/true +} + # get version of a package from global requirements file # get_from_global_requirements function get_from_global_requirements { diff --git a/lib/nova_plugins/functions-libvirt b/lib/nova_plugins/functions-libvirt index 47605af991..326c8bf4ae 100644 --- a/lib/nova_plugins/functions-libvirt +++ b/lib/nova_plugins/functions-libvirt @@ -67,6 +67,8 @@ function install_libvirt { else install_package libvirt-clients libvirt-daemon-system libvirt-dev fi + # uninstall in case the libvirt version changed + pip_uninstall libvirt-python pip_install_gr libvirt-python #pip_install_gr elif is_fedora || is_suse; then @@ -84,6 +86,7 @@ function install_libvirt { fi install_package libvirt libvirt-devel + pip_uninstall libvirt-python pip_install_gr libvirt-python fi