Remove libvirt-python from upper-constraints
... when installed from distribution.
This is mostly to fix Ironic's gate as their ecosystem is too
broad and complex to quickly remove libvirt-python from all
possible requirements.txt
More details inline.
See also: https://review.opendev.org/c/openstack/devstack/+/798514
aka f0bf2bdff12b66eefbb2eae83e919611eb7cc76d
Change-Id: Ic44daf15e952bbe3c424984ffb2474261e68008f
diff --git a/lib/nova_plugins/functions-libvirt b/lib/nova_plugins/functions-libvirt
index e9ceae4..63882e0 100644
--- a/lib/nova_plugins/functions-libvirt
+++ b/lib/nova_plugins/functions-libvirt
@@ -56,6 +56,17 @@
# Installs required distro-specific libvirt packages.
function install_libvirt {
+ # NOTE(yoctozepto): The common consensus [1] is that libvirt-python should
+ # be installed from distro packages. However, various projects might be
+ # trying to ensure it is installed using pip AND use upper-constraints
+ # with that, causing pip to try to upgrade it and to fail.
+ # The following line removes libvirt-python from upper-constraints and
+ # avoids the situation described above. Now only if installed packages
+ # explicitly depend on a newer (or, in general, incompatible) libvirt-python
+ # version, will pip try to reinstall it.
+ # [1] https://review.opendev.org/c/openstack/devstack/+/798514
+ $REQUIREMENTS_DIR/.venv/bin/edit-constraints \
+ $REQUIREMENTS_DIR/upper-constraints.txt -- libvirt-python
if is_ubuntu; then
install_package qemu-system libvirt-clients libvirt-daemon-system libvirt-dev python3-libvirt