diff --git a/defaults/main.yml b/defaults/main.yml index 7b34ebcd..2465ffed 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/releasenotes/notes/os_nova-install-venv-6c6c2ba28f67a891.yaml b/releasenotes/notes/os_nova-install-venv-6c6c2ba28f67a891.yaml new file mode 100644 index 00000000..e4b355f6 --- /dev/null +++ b/releasenotes/notes/os_nova-install-venv-6c6c2ba28f67a891.yaml @@ -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. diff --git a/tasks/nova_compute_kvm_install.yml b/tasks/nova_compute_kvm_install.yml index e750fcd6..b1e99945 100644 --- a/tasks/nova_compute_kvm_install.yml +++ b/tasks/nova_compute_kvm_install.yml @@ -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 diff --git a/tasks/nova_compute_powervm_install.yml b/tasks/nova_compute_powervm_install.yml index e2e8cbab..554f893a 100644 --- a/tasks/nova_compute_powervm_install.yml +++ b/tasks/nova_compute_powervm_install.yml @@ -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 diff --git a/tasks/nova_console_novnc_install.yml b/tasks/nova_console_novnc_install.yml index dc234dd7..4be6eab8 100644 --- a/tasks/nova_console_novnc_install.yml +++ b/tasks/nova_console_novnc_install.yml @@ -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: diff --git a/tasks/nova_install.yml b/tasks/nova_install.yml index f40db576..f1172c06 100644 --- a/tasks/nova_install.yml +++ b/tasks/nova_install.yml @@ -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 diff --git a/tasks/nova_post_install.yml b/tasks/nova_post_install.yml index 50386d92..483272f8 100644 --- a/tasks/nova_post_install.yml +++ b/tasks/nova_post_install.yml @@ -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" diff --git a/tasks/nova_pre_install.yml b/tasks/nova_pre_install.yml index cf420c4d..7cdf09c4 100644 --- a/tasks/nova_pre_install.yml +++ b/tasks/nova_pre_install.yml @@ -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 diff --git a/templates/nova-upstart-init.j2 b/templates/nova-upstart-init.j2 index f4a486ef..6a8159d1 100644 --- a/templates/nova-upstart-init.j2 +++ b/templates/nova-upstart-init.j2 @@ -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 diff --git a/tests/test-vars.yml b/tests/test-vars.yml index 2ac3bd5b..53233784 100644 --- a/tests/test-vars.yml +++ b/tests/test-vars.yml @@ -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"