From e72835e5ac97f51665add4ade2a737eab12b3a9e Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 20 Dec 2019 21:00:47 +0200 Subject: [PATCH] Use py3 for CentOS Unfortunatelly CentOS 7 do not have libvirt and guestfs libraries for py3, so isntead of symlinking them, we have to install devel package and build inside venv. Change-Id: Ie678e44c2369347cf0816cbcc4269de8eba7b963 --- tasks/nova_install.yml | 15 +++++++++++++++ vars/redhat.yml | 17 ++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/tasks/nova_install.yml b/tasks/nova_install.yml index 8aa4554c..f1f81303 100644 --- a/tasks/nova_install.yml +++ b/tasks/nova_install.yml @@ -61,6 +61,21 @@ value: "{{ nova_venv_tag }}" when: nova_install_method == 'source' +# NOTE(noonedeadpunk): This task can't be done in python_venv_build role +# because installation from file/url can't be used with constraints. +# Here we install packages which are missing in disto, so can't be +# symlinked inside venv. +- name: Install kvm pip packages + pip: + name: "{{ nova_compute_kvm_pip_packages }}" + virtualenv: "{{ nova_bin | dirname }}" + state: present + when: + - nova_install_method == 'source' + - nova_services['nova-compute']['group'] in group_names + - ansible_os_family | lower == 'redhat' + - ansible_distribution_major_version|int <= 7 + - include_tasks: "consoles/nova_console_{{ nova_console_type }}_install.yml" when: - "nova_services['nova-novncproxy']['group'] in group_names or diff --git a/vars/redhat.yml b/vars/redhat.yml index e2992c0a..b22fc5af 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -62,15 +62,22 @@ nova_compute_kvm_distro_packages: - libvirt-daemon-kvm - "qemu-kvm{% if ansible_distribution_major_version|int <= 7 %}-ev{% endif %}" - libvirt-client - - libvirt-python + - "{{ (ansible_distribution_major_version|int <= 7) | ternary('libvirt-devel', 'python3-libvirt') }}" - nfs-utils - - python-libguestfs + - "{{ (ansible_distribution_major_version|int <= 7) | ternary('libguestfs-devel', 'python3-libguestfs') }}" - "qemu-img{% if ansible_distribution_major_version|int <= 7 %}-ev{% endif %}" - "{{ (ansible_architecture == 'aarch64') | ternary('AAVMF', 'OVMF') }}" -nova_compute_kvm_packages_to_symlink: - - "{% if ansible_distribution_major_version|int <= 7 %}libvirt-python{% else %}python2-libvirt{% endif %}" - - "python{% if ansible_distribution_major_version|int > 7 %}2{% endif %}-libguestfs" +nova_compute_kvm_packages_to_symlink: |- + {% set packages = [] %} + {% if ansible_distribution_major_version|int > 7 %} + {% set _ = packages.extend(['python3-libvirt', 'python3-libguestfs']) %} + {% endif %} + {{ packages }} + +nova_compute_kvm_pip_packages: + - http://download.libguestfs.org/python/guestfs-1.40.2.tar.gz + - libvirt-python nova_compute_ksm_packages: - ksmtuned