Use the distro package for libvirt-python

The libvirt-python library has C bindings which are very particular
about the version of its companion package (libvirt). To ensure
things run smoothly for stable releases, we opt to use the distro
packages for these and symlink the appropriate library files and
binding into the venv.

This approach has been used successfully for the ceph python bindings.

Change-Id: Id962efe16c425424715409f071c4a304f8416001
This commit is contained in:
Jesse Pretorius 2018-05-30 18:49:13 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 718d8da567
commit 3d78d07015
3 changed files with 53 additions and 27 deletions

View File

@ -512,9 +512,6 @@ nova_requires_pip_packages:
- httplib2 - httplib2
- python-openstackclient - python-openstackclient
nova_compute_pip_packages:
- libvirt-python
nova_compute_ironic_pip_packages: nova_compute_ironic_pip_packages:
- python-ironicclient - python-ironicclient

View File

@ -0,0 +1,19 @@
---
issues:
- |
With the release of CentOS 7.5, all pike releases are broken due to a
mismatch in version between the libvirt-python library specified by the
OpenStack community, and the version provided in CentOS 7.5. As such OSA
is unable build the appropriate python library for libvirt. The only
recourse for this is to upgrade the environment to the latest queens
release.
fixes:
- |
In order to prevent further issues with a libvirt and python-libvirt
version mismatch, KVM-based compute nodes will now use the distribution
package python library for libvirt. This should resolve the issue seen
with pike builds on CentOS 7.5.
deprecations:
- |
The variable ``nova_compute_pip_packages`` is no longer used and has
been removed.

View File

@ -55,31 +55,13 @@
owner: "{{ nova_qemu_user }}" owner: "{{ nova_qemu_user }}"
group: "{{ nova_qemu_group }}" group: "{{ nova_qemu_group }}"
- name: Install pip packages # Note (odyssey4me):
pip: # These python libraries have C bindings which tend to be very
name: "{{ nova_compute_pip_packages }}" # particular about the version of their companion packages.
state: "{{ nova_pip_package_state }}" # To ensure things run smoothly for stable releases, we opt to
virtualenv: "{{ nova_bin | dirname }}" # use the distro packages for these and symlink the appropriate
virtualenv_site_packages: "no" # library files and binding into the venv.
extra_args: >-
{{ nova_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options|default('') }}
register: install_packages
until: install_packages|success
retries: 5
delay: 2
when:
- nova_get_venv | failed or nova_get_venv | skipped
tags:
- nova-pip-packages
# TODO(cloudnull): use a package from pypi when its made available
# This is being done because guestfs is not an installable package at this time.
# There is a change in the works to upload the guestfs package to pypi in the
# future however that's not been done as of yet.
# related thread http://lists.openstack.org/pipermail/openstack-dev/2015-July/070927.html
# link on bug about libguestfs on pypi https://bugzilla.redhat.com/show_bug.cgi?id=1075594
- name: Link guestfs into the venv - name: Link guestfs into the venv
file: file:
src: "{{ linkfiles.name }}" src: "{{ linkfiles.name }}"
@ -93,3 +75,31 @@
loop_var: linkfiles loop_var: linkfiles
tags: tags:
- nova-pip-packages - nova-pip-packages
- name: Register libvirt module path
command: python -c 'import libvirt; print libvirt.__file__'
changed_when: false
register: _libvirt_module_path
tags:
- nova-pip-packages
- name: Register libvirt-python files
shell: >-
{{ (ansible_pkg_mgr == 'apt') | ternary('dpkg -L python-libvirt', 'rpm -ql libvirt-python') }}
| grep '^{{ _libvirt_module_path.stdout | dirname }}/'
args:
warn: no
changed_when: false
register: _libvirt_python_files
tags:
- nova-pip-packages
- name: Link the libvirt files into venv
file:
src: "{{ item }}"
dest: "{{ nova_bin | dirname }}/lib/python2.7/site-packages/{{ item | basename }}"
state: link
force: yes
with_items: "{{ _libvirt_python_files.stdout_lines }}"
tags:
- nova-pip-packages