Only install to virtual environment
Remove all tasks and variables related to toggling between installation of nova inside or outside of a Python virtual environment. Installing within a venv is now the only supported deployment. Additionally, a few changes have been made to make the creation of the venv more resistant to interruptions during a run of the role. * unarchiving a pre-built venv will now also occur when the venv directory is created, not only after being downloaded * virtualenv-tools is run against both pre-built and non pre-built venvs to account for interruptions during or prior to unarchiving Change-Id: Ia8687d49803705702f0e9f7ea9a83d3c05694d46 Implements: blueprint only-install-venvs
This commit is contained in:
parent
e732f40b2c
commit
7f69cdd1df
@ -29,15 +29,7 @@ nova_developer_constraints:
|
||||
|
||||
# Name of the virtual env to deploy into
|
||||
nova_venv_tag: untagged
|
||||
nova_venv_bin: "/openstack/venvs/nova-{{ nova_venv_tag }}/bin"
|
||||
|
||||
# Set this to enable or disable installing in a venv
|
||||
nova_venv_enabled: true
|
||||
|
||||
# The bin path defaults to the venv path however if installation in a
|
||||
# venv is disabled the bin path will be dynamically set based on the
|
||||
# system path used when the installing.
|
||||
nova_bin: "{{ nova_venv_bin }}"
|
||||
nova_bin: "/openstack/venvs/nova-{{ nova_venv_tag }}/bin"
|
||||
|
||||
nova_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/nova.tgz
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- Installation of nova and its dependent pip packages will now only
|
||||
occur within a Python virtual environment. The ``nova_venv_enabled``,
|
||||
``nova_venv_bin`` variables have been removed.
|
@ -36,11 +36,11 @@
|
||||
- qemu_savedir_stat.stat.isdir
|
||||
- qemu_savedir_empty.stdout_lines | length == 0
|
||||
|
||||
- name: Install pip packages (venv)
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ nova_venv_bin | dirname }}"
|
||||
virtualenv: "{{ nova_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options|default('') }}"
|
||||
register: install_packages
|
||||
@ -49,7 +49,6 @@
|
||||
delay: 2
|
||||
with_items: "{{ nova_compute_pip_packages }}"
|
||||
when:
|
||||
- nova_venv_enabled | bool
|
||||
- nova_get_venv | failed or nova_developer_mode | bool
|
||||
tags:
|
||||
- nova-install
|
||||
@ -60,31 +59,16 @@
|
||||
# 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: "{{ item.name }}"
|
||||
dest: "{{ nova_venv_bin | dirname }}/lib/python2.7/{{ item.name | basename }}"
|
||||
dest: "{{ nova_bin | dirname }}/lib/python2.7/{{ item.name | basename }}"
|
||||
state: "{{ item.state }}"
|
||||
force: "yes"
|
||||
with_items:
|
||||
- { state: link, name: "/usr/lib/python2.7/dist-packages/libguestfsmod.so" }
|
||||
- { state: link, name: "/usr/lib/python2.7/dist-packages/guestfs.py" }
|
||||
when: nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
|
||||
- name: Install pip packages (no venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
extra_args: "{{ pip_install_options|default('') }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ nova_compute_pip_packages }}"
|
||||
when: not nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
|
@ -74,27 +74,23 @@
|
||||
- name: Register pypowervm module path (venv)
|
||||
command: python -c 'import pypowervm; print pypowervm.__file__'
|
||||
register: pypowervm_module_path
|
||||
when:
|
||||
- nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-powervm-libs
|
||||
|
||||
- name: Link pypowervm module into the venv
|
||||
file:
|
||||
src: "{{ pypowervm_module_path.stdout | dirname }}"
|
||||
dest: "{{ nova_venv_bin | dirname }}/lib/python2.7/site-packages/pypowervm"
|
||||
dest: "{{ nova_bin | dirname }}/lib/python2.7/site-packages/pypowervm"
|
||||
state: link
|
||||
force: "yes"
|
||||
when:
|
||||
- nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-powervm-libs
|
||||
|
||||
- name: Install pip packages (venv)
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ nova_venv_bin | dirname }}"
|
||||
virtualenv: "{{ nova_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options|default('') }}"
|
||||
register: install_packages
|
||||
@ -102,61 +98,15 @@
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ nova_compute_powervm_pip_packages }}"
|
||||
when:
|
||||
- nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
|
||||
- name: Install pip packages (no venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
extra_args: "{{ pip_install_options|default('') }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ nova_compute_powervm_pip_packages }}"
|
||||
when: not nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
|
||||
- name: Register nova module path (no venv)
|
||||
command: python -c 'import nova; print nova.__file__'
|
||||
register: nova_module_path
|
||||
when:
|
||||
- not nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-powervm-libs
|
||||
|
||||
- name: Register nova_powervm module path (no venv)
|
||||
command: python -c 'import nova_powervm; print nova_powervm.__file__'
|
||||
register: nova_powervm_module_path
|
||||
when:
|
||||
- not nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-powervm-libs
|
||||
|
||||
- name: Link nova_powervm module into the nova virt (no venv)
|
||||
- name: Link nova_powervm module into the nova virt
|
||||
file:
|
||||
src: "{{ nova_powervm_module_path.stdout | dirname }}/virt/powervm"
|
||||
dest: "{{ nova_module_path.stdout | dirname }}/virt/powervm"
|
||||
src: "{{ nova_bin | dirname }}/lib/python2.7/site-packages/nova_powervm/virt/powervm"
|
||||
dest: "{{ nova_bin | dirname }}/lib/python2.7/site-packages/nova/virt/powervm"
|
||||
state: link
|
||||
force: "yes"
|
||||
when:
|
||||
- not nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-powervm-libs
|
||||
|
||||
- name: Link nova_powervm module into the nova virt (venv)
|
||||
file:
|
||||
src: "{{ nova_venv_bin | dirname }}/lib/python2.7/site-packages/nova_powervm/virt/powervm"
|
||||
dest: "{{ nova_venv_bin | dirname }}/lib/python2.7/site-packages/nova/virt/powervm"
|
||||
state: link
|
||||
force: "yes"
|
||||
when:
|
||||
- nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-powervm-libs
|
||||
|
@ -38,11 +38,11 @@
|
||||
- nova-install
|
||||
- nova-novnc-git
|
||||
|
||||
- name: Install pip packages (venv)
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ nova_venv_bin | dirname }}"
|
||||
virtualenv: "{{ nova_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options|default('') }}"
|
||||
register: install_packages
|
||||
@ -51,27 +51,11 @@
|
||||
delay: 2
|
||||
with_items: "{{ nova_novnc_pip_packages }}"
|
||||
when:
|
||||
- nova_venv_enabled | bool
|
||||
- nova_get_venv | failed or nova_developer_mode | bool
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
|
||||
- name: Install pip packages (no venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
extra_args: "{{ pip_install_options|default('') }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ nova_novnc_pip_packages }}"
|
||||
when: not nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-novnc-pip-packages
|
||||
|
||||
- include: nova_console_novnc_ssl.yml
|
||||
when: nova_console_user_ssl_cert is defined and nova_console_user_ssl_key is defined
|
||||
tags:
|
||||
|
@ -95,7 +95,6 @@
|
||||
get_md5: False
|
||||
when:
|
||||
- not nova_developer_mode | bool
|
||||
- nova_venv_enabled | bool
|
||||
register: local_venv_stat
|
||||
tags:
|
||||
- nova-install
|
||||
@ -107,7 +106,6 @@
|
||||
return_content: True
|
||||
when:
|
||||
- not nova_developer_mode | bool
|
||||
- nova_venv_enabled | bool
|
||||
register: remote_venv_checksum
|
||||
tags:
|
||||
- nova-install
|
||||
@ -127,7 +125,6 @@
|
||||
register: get_venv
|
||||
when:
|
||||
- not nova_developer_mode | bool
|
||||
- nova_venv_enabled | bool
|
||||
- (local_venv_stat.stat.exists == False or
|
||||
{{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }})
|
||||
tags:
|
||||
@ -137,17 +134,15 @@
|
||||
- name: Set nova get_venv fact
|
||||
set_fact:
|
||||
nova_get_venv: "{{ get_venv }}"
|
||||
when: nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
|
||||
- name: Remove existing venv
|
||||
file:
|
||||
path: "{{ nova_venv_bin | dirname }}"
|
||||
path: "{{ nova_bin | dirname }}"
|
||||
state: absent
|
||||
when:
|
||||
- nova_venv_enabled | bool
|
||||
- nova_get_venv | changed
|
||||
tags:
|
||||
- nova-install
|
||||
@ -155,12 +150,9 @@
|
||||
|
||||
- name: Create nova venv dir
|
||||
file:
|
||||
path: "{{ nova_venv_bin | dirname }}"
|
||||
path: "{{ nova_bin | dirname }}"
|
||||
state: directory
|
||||
when:
|
||||
- not nova_developer_mode | bool
|
||||
- nova_venv_enabled | bool
|
||||
- nova_get_venv | changed
|
||||
register: nova_venv_dir
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
@ -168,33 +160,21 @@
|
||||
- name: Unarchive pre-built venv
|
||||
unarchive:
|
||||
src: "/var/cache/{{ nova_venv_download_url | basename }}"
|
||||
dest: "{{ nova_venv_bin | dirname }}"
|
||||
dest: "{{ nova_bin | dirname }}"
|
||||
copy: "no"
|
||||
when:
|
||||
- not nova_developer_mode | bool
|
||||
- nova_venv_enabled | bool
|
||||
- nova_get_venv | changed
|
||||
- nova_get_venv | changed or nova_venv_dir | changed
|
||||
notify: Restart nova services
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ nova_venv_bin | dirname }}
|
||||
when:
|
||||
- not nova_developer_mode | bool
|
||||
- nova_venv_enabled | bool
|
||||
- nova_get_venv | success
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
|
||||
- name: Install pip packages (venv)
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ nova_venv_bin | dirname }}"
|
||||
virtualenv: "{{ nova_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
@ -203,27 +183,18 @@
|
||||
delay: 2
|
||||
with_items: "{{ nova_pip_packages }}"
|
||||
when:
|
||||
- nova_venv_enabled | bool
|
||||
- nova_get_venv | failed or nova_developer_mode | bool
|
||||
notify: Restart nova services
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
|
||||
- name: Install pip packages (no venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ nova_pip_packages }}"
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ nova_bin | dirname }}
|
||||
when:
|
||||
- not nova_developer_mode | bool
|
||||
- not nova_venv_enabled | bool
|
||||
notify: Restart nova services
|
||||
- nova_get_venv | success
|
||||
tags:
|
||||
- nova-install
|
||||
- nova-pip-packages
|
||||
|
@ -75,22 +75,6 @@
|
||||
- nova-config
|
||||
- nova-post-install
|
||||
|
||||
- name: Get nova command path
|
||||
command: which nova
|
||||
register: nova_command_path
|
||||
when:
|
||||
- not nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-command-bin
|
||||
|
||||
- name: Set nova command path
|
||||
set_fact:
|
||||
nova_bin: "{{ nova_command_path.stdout | dirname }}"
|
||||
when:
|
||||
- not nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-command-bin
|
||||
|
||||
- name: Drop sudoers file
|
||||
template:
|
||||
src: "sudoers.j2"
|
||||
|
@ -74,17 +74,6 @@
|
||||
tags:
|
||||
- nova-dirs
|
||||
|
||||
- name: Create nova venv dir
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- { path: "/openstack/venvs" }
|
||||
- { path: "{{ nova_venv_bin }}" }
|
||||
when: nova_venv_enabled | bool
|
||||
tags:
|
||||
- nova-dirs
|
||||
|
||||
- name: Test for log directory or link
|
||||
shell: |
|
||||
if [ -h "/var/log/nova" ]; then
|
||||
|
@ -23,9 +23,7 @@ pre-start script
|
||||
mkdir -p "/var/lock/{{ program_name }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
|
||||
|
||||
{% if nova_venv_enabled | bool -%}
|
||||
. {{ nova_venv_bin }}/activate
|
||||
{%- endif %}
|
||||
. {{ nova_bin }}/activate
|
||||
|
||||
end script
|
||||
|
||||
|
@ -114,7 +114,7 @@ nova_service_project_name: service
|
||||
nova_service_region: RegionOne
|
||||
nova_service_user_domain_id: default
|
||||
nova_service_user_name: nova
|
||||
nova_venv_bin: "/openstack/venvs/nova-{{ nova_venv_tag }}/bin"
|
||||
nova_bin: "/openstack/venvs/nova-{{ nova_venv_tag }}/bin"
|
||||
nova_venv_tag: "testing"
|
||||
nova_virt_type: qemu
|
||||
openrc_os_auth_url: "http://127.0.0.1:5000/v3"
|
||||
|
Loading…
Reference in New Issue
Block a user