Update role for new source build process

The variables nova_developer_mode and nova_venv_download
no longer carry any meaning. This review changes nova to
do the equivalent of what developer_mode was all the time,
meaning that it always builds the venv and never requires
the repo server, but it will use a repo server when available.

We also change include_tasks to import_tasks and include_role
to import_role so that the tags in the python_venv_build role
will work.

Change-Id: I1a1ac5948f3bd647eb0ee5e10e9e7ae06b740bb7
This commit is contained in:
Jesse Pretorius 2019-03-27 10:34:52 +00:00 committed by Jesse Pretorius (odyssey4me)
parent 21703a6dfd
commit 377588a57c
10 changed files with 55 additions and 175 deletions

View File

@ -52,31 +52,17 @@ nova_git_install_branch: master
nova_lxd_git_repo: https://git.openstack.org/openstack/nova-lxd
nova_lxd_git_install_branch: master
nova_developer_mode: false
nova_developer_constraints:
nova_upper_constraints_url: "{{ requirements_git_url | default('https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=' ~ requirements_git_install_branch | default('master')) }}"
nova_git_constraints:
- "git+{{ nova_git_repo }}@{{ nova_git_install_branch }}#egg=nova"
- "git+{{ nova_lxd_git_repo }}@{{ nova_lxd_git_install_branch }}#egg=nova-lxd"
# TODO(odyssey4me):
# This can be simplified once all the roles are using
# python_venv_build. We can then switch to using a
# set of constraints in pip.conf inside the venv,
# perhaps prepared by giving a giving a list of
# constraints to the role.
nova_pip_install_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('') }}
- "--constraint {{ nova_upper_constraints_url }}"
nova_pip_install_args: "{{ pip_install_options | default('') }}"
# Name of the virtual env to deploy into
nova_venv_tag: "{{ venv_tag | default('untagged') }}"
nova_bin: "{{ _nova_bin }}"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
nova_venv_download: "{{ not nova_developer_mode | bool }}"
nova_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/nova.tgz
nova_fatal_deprecations: False
## Nova user information

View File

@ -1,18 +0,0 @@
---
# Copyright 2016, Walmart Stores, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install nova ironic packages from PIP
include_tasks: nova_compute_ironic_source.yml
when: nova_install_method == 'source'

View File

@ -1,32 +0,0 @@
---
# Copyright 2018, SUSE Linux GmbH.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install pip packages (venv)
pip:
name: "{{ nova_compute_ironic_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 is success
retries: 5
delay: 2
tags:
- nova-install
- nova-pip-packages

View File

@ -13,10 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install nova lxd packages from PIP
include_tasks: nova_compute_lxd_source.yml
when: nova_install_method == 'source'
- name: Add nova user to lxd group
user:
name: "{{ nova_system_user_name }}"

View File

@ -1,31 +0,0 @@
---
# Copyright 2018, SUSE Linux GmbH.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install pip packages (venv)
pip:
name: "{{ nova_compute_lxd_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 is success
retries: 5
delay: 2
tags:
- nova-pip-packages

View File

@ -69,23 +69,23 @@
tags:
- always
- include_tasks: nova_virt_detect.yml
- import_tasks: nova_virt_detect.yml
when:
- nova_virt_type is not defined
tags:
- always
- nova-config
- include_tasks: nova_vgpu_detect.yml
- import_tasks: nova_vgpu_detect.yml
tags:
- always
- nova-config
- include_tasks: nova_pre_install.yml
- import_tasks: nova_pre_install.yml
tags:
- nova-install
- include_tasks: nova_install.yml
- import_tasks: nova_install.yml
tags:
- nova-install
@ -96,11 +96,11 @@
tags:
- nova-config
- include_tasks: nova_post_install.yml
- import_tasks: nova_post_install.yml
tags:
- nova-config
- include_tasks: nova_service_setup.yml
- import_tasks: nova_service_setup.yml
when:
- "nova_services['nova-conductor']['group'] in group_names"
- "inventory_hostname == ((groups['nova_conductor'] | intersect(ansible_play_hosts)) | list)[0]"
@ -126,19 +126,19 @@
- common-mq
- nova-config
- include_tasks: nova_db_setup.yml
- import_tasks: nova_db_setup.yml
when:
- "nova_services['nova-conductor']['group'] in group_names"
- "inventory_hostname == ((groups['nova_conductor'] | intersect(ansible_play_hosts)) | list)[0]"
tags:
- nova-config
- include_tasks: nova_uwsgi.yml
- import_tasks: nova_uwsgi.yml
tags:
- nova-config
- name: Run the systemd service role
include_role:
import_role:
name: systemd_service
vars:
systemd_user_name: "{{ nova_system_user_name }}"
@ -170,14 +170,14 @@
- nova-config
- systemd-service
- include_tasks: nova_compute.yml
- import_tasks: nova_compute.yml
when:
- "nova_services['nova-compute']['group'] in group_names"
tags:
- nova-compute
- name: Include ceph_client role
include_role:
import_role:
name: ceph_client
vars:
openstack_service_system_user: "{{ nova_system_user_name }}"

View File

@ -14,6 +14,8 @@
# limitations under the License.
- include_tasks: "drivers/{{ nova_virt_type }}/nova_compute_{{ nova_virt_type }}.yml"
when:
- nova_virt_type != 'ironic'
tags:
- nova-install

View File

@ -45,8 +45,26 @@
tags:
- nova-pip-packages
- name: Install nova packages from PIP
include_tasks: nova_install_source.yml
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ nova_git_constraints }}"
venv_build_distro_package_list: "{{ nova_devel_distro_packages }}"
venv_install_destination_path: "{{ nova_bin | dirname }}"
venv_pip_install_args: "{{ nova_pip_install_args }}"
venv_packages_to_symlink: "{{ (nova_services['nova-compute']['group'] in group_names) | ternary(nova_compute_kvm_packages_to_symlink, []) }}"
venv_pip_packages: "{{ nova_venv_packages }}"
venv_facts_when_changed:
- section: "nova"
option: "need_service_restart"
value: "True"
- section: "nova"
option: "need_online_data_migrations"
value: "True"
- section: "nova"
option: "venv_tag"
value: "{{ nova_venv_tag }}"
when: nova_install_method == 'source'
- include_tasks: "consoles/nova_console_{{ nova_console_type }}_install.yml"

View File

@ -1,59 +0,0 @@
---
# Copyright 2018, SUSE Linux GmbH.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# TODO(odyssey4me):
# This can be simplified once all the roles are using
# python_venv_build. We can then switch to using a
# set of constraints in pip.conf inside the venv,
# perhaps prepared by giving a giving a list of
# constraints to the role.
- name: Create developer mode constraint file
copy:
dest: "/opt/developer-pip-constraints.txt"
content: |
{% for item in nova_developer_constraints %}
{{ item }}
{% endfor %}
when:
- nova_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ inventory_hostname }}"
when:
- nova_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_distro_package_list: "{{ nova_devel_distro_packages }}"
venv_install_destination_path: "{{ nova_bin | dirname }}"
venv_pip_install_args: "{{ nova_pip_install_args }}"
venv_packages_to_symlink: "{{ (nova_services['nova-compute']['group'] in group_names) | ternary(nova_compute_kvm_packages_to_symlink, []) }}"
venv_pip_packages: >-
{{ nova_pip_packages | union(nova_user_pip_packages) +
((nova_services['nova-novncproxy']['group'] in group_names) and (nova_console_type == 'novnc')) | ternary(nova_novnc_pip_packages, []) +
(nova_oslomsg_amqp1_enabled | bool) | ternary(nova_optional_oslomsg_amqp1_pip_packages, []) }}
venv_facts_when_changed:
- section: "nova"
option: "need_service_restart"
value: "True"
- section: "nova"
option: "need_online_data_migrations"
value: "True"
- section: "nova"
option: "venv_tag"
value: "{{ nova_venv_tag }}"

View File

@ -13,6 +13,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
nova_venv_packages: |-
{%- set pkg_list = nova_pip_packages | union(nova_user_pip_packages) %}
{%- if nova_oslomsg_amqp1_enabled | bool %}
{%- set _ = pkg_list.extend(nova_optional_oslomsg_amqp1_pip_packages) %}
{%- endif %}
{%- if (nova_services['nova-novncproxy']['group'] in group_names) and
(nova_console_type == 'novnc') %}
{%- set _ = pkg_list.extend(nova_novnc_pip_packages) %}
{%- endif %}
{%- if (nova_services['nova-compute']['group'] in group_names) %}
{%- if nova_virt_type == 'lxd' %}
{%- set _ = pkg_list.extend(nova_compute_lxd_pip_packages) %}
{%- elif nova_virt_type == 'ironic' %}
{%- set _ = pkg_list.extend(nova_compute_ironic_pip_packages) %}
{%- endif %}
{%- endif %}
{{- pkg_list | unique }}
#
# Compile a list of the services on a host based on whether
# the host is in the host group and the service is enabled.