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 and libvirt python bindings in other roles. Change-Id: I23bf430087af8b16a3d77d96f6ceb3d7f6d8a9d5
This commit is contained in:
parent
b1e4877ac3
commit
6d2ad6a004
@ -236,7 +236,6 @@ ceilometer_pip_packages:
|
||||
- ceilometermiddleware
|
||||
- cryptography
|
||||
- gnocchiclient
|
||||
- libvirt-python
|
||||
- osprofiler
|
||||
- PyMySQL
|
||||
- pymongo
|
||||
|
@ -48,3 +48,41 @@
|
||||
- section: "ceilometer"
|
||||
option: "venv_tag"
|
||||
value: "{{ ceilometer_venv_tag }}"
|
||||
|
||||
# Note (odyssey4me):
|
||||
# These python libraries have C bindings which tend to be very
|
||||
# particular about the version of their companion packages.
|
||||
# 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.
|
||||
|
||||
- name: Find the venv's python version
|
||||
find:
|
||||
paths: "{{ ceilometer_bin | dirname }}/lib/"
|
||||
patterns: "python*"
|
||||
file_type: directory
|
||||
recurse: no
|
||||
register: python_venv_details
|
||||
|
||||
- name: Set python venvs details
|
||||
set_fact:
|
||||
venv_python_version: "{{ (python_venv_details.files[0].path | basename) }}"
|
||||
venv_python_major_version: "{{ (python_venv_details.files[0].path | basename)[:-2] }}"
|
||||
venv_python_lib_folder: "{{ python_venv_details.files[0].path }}"
|
||||
|
||||
- name: Search for lib files to link
|
||||
shell: >-
|
||||
{{ (ansible_pkg_mgr == 'apt') | ternary('dpkg -L ' ~ (ceilometer_packages_to_symlink | join(' ')), 'rpm -ql ' ~ (ceilometer_packages_to_symlink | join(' ')) ) }}
|
||||
| egrep '^.*{{ venv_python_major_version }}.*/(site|dist)-packages/.*'
|
||||
args:
|
||||
warn: no
|
||||
changed_when: false
|
||||
register: _python_files
|
||||
|
||||
- name: Link the python host package files into venv
|
||||
file:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ venv_python_lib_folder }}/site-packages/{{ item | basename }}"
|
||||
state: link
|
||||
force: yes
|
||||
with_items: "{{ _python_files.stdout_lines }}"
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
ceilometer_distro_packages:
|
||||
- git
|
||||
- libvirt-python
|
||||
|
||||
ceilometer_devel_distro_packages:
|
||||
- systemd-devel
|
||||
@ -38,3 +39,6 @@ ceilometer_oslomsg_amqp1_distro_packages:
|
||||
- cyrus-sasl-lib
|
||||
- cyrus-sasl-plain
|
||||
- cyrus-sasl-md5
|
||||
|
||||
ceilometer_packages_to_symlink:
|
||||
- libvirt-python
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
ceilometer_distro_packages:
|
||||
- git-core
|
||||
- "{{ (ansible_distribution_version is version ('42', '>=')) | ternary('libvirt-python', 'python2-libvirt-python') }}"
|
||||
|
||||
ceilometer_devel_distro_packages:
|
||||
- pkg-config
|
||||
@ -41,3 +42,6 @@ ceilometer_oslomsg_amqp1_distro_packages:
|
||||
- cyrus-sasl
|
||||
- cyrus-sasl-plain
|
||||
- cyrus-sasl-digestmd5
|
||||
|
||||
ceilometer_packages_to_symlink:
|
||||
- "{{ (ansible_distribution_version is version ('42', '>=')) | ternary('libvirt-python', 'python2-libvirt-python') }}"
|
||||
|
@ -19,6 +19,8 @@ cache_timeout: 600
|
||||
# Common apt packages
|
||||
ceilometer_distro_packages:
|
||||
- git
|
||||
- python-libvirt
|
||||
- python3-libvirt
|
||||
|
||||
ceilometer_devel_distro_packages: []
|
||||
|
||||
@ -40,3 +42,7 @@ ceilometer_developer_mode_distro_packages:
|
||||
ceilometer_oslomsg_amqp1_distro_packages:
|
||||
- libsasl2-modules
|
||||
- sasl2-bin
|
||||
|
||||
ceilometer_packages_to_symlink:
|
||||
- python-libvirt
|
||||
- python3-libvirt
|
||||
|
Loading…
Reference in New Issue
Block a user