From 3d78d07015601151e33bd63123b1a4c63cf2a756 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 30 May 2018 18:49:13 +0100 Subject: [PATCH] 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 --- defaults/main.yml | 3 - ...bvirt-python-symlink-e892dd3536c02179.yaml | 19 ++++++ .../drivers/kvm/nova_compute_kvm_install.yml | 58 +++++++++++-------- 3 files changed, 53 insertions(+), 27 deletions(-) create mode 100644 releasenotes/notes/libvirt-python-symlink-e892dd3536c02179.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 04c4a83a..65c390c8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -512,9 +512,6 @@ nova_requires_pip_packages: - httplib2 - python-openstackclient -nova_compute_pip_packages: - - libvirt-python - nova_compute_ironic_pip_packages: - python-ironicclient diff --git a/releasenotes/notes/libvirt-python-symlink-e892dd3536c02179.yaml b/releasenotes/notes/libvirt-python-symlink-e892dd3536c02179.yaml new file mode 100644 index 00000000..0b937e6d --- /dev/null +++ b/releasenotes/notes/libvirt-python-symlink-e892dd3536c02179.yaml @@ -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. diff --git a/tasks/drivers/kvm/nova_compute_kvm_install.yml b/tasks/drivers/kvm/nova_compute_kvm_install.yml index 12ac1d24..72a68253 100644 --- a/tasks/drivers/kvm/nova_compute_kvm_install.yml +++ b/tasks/drivers/kvm/nova_compute_kvm_install.yml @@ -55,31 +55,13 @@ owner: "{{ nova_qemu_user }}" group: "{{ nova_qemu_group }}" -- name: Install pip packages - pip: - name: "{{ nova_compute_pip_packages }}" - state: "{{ nova_pip_package_state }}" - virtualenv: "{{ nova_bin | dirname }}" - virtualenv_site_packages: "no" - 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 +# 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. -# 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 file: src: "{{ linkfiles.name }}" @@ -93,3 +75,31 @@ loop_var: linkfiles tags: - 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