Update role for new source build process

The variables neutron_developer_mode and neutron_venv_download
no longer carry any meaning. This review changes neutron 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: Ib4958fc3b2e87768f00d23bca48458bcffe1c498
This commit is contained in:
Jesse Pretorius 2019-03-27 10:43:44 +00:00 committed by Jesse Pretorius (odyssey4me)
parent edff8ab810
commit 01857d45c9
10 changed files with 69 additions and 182 deletions

View File

@ -75,9 +75,8 @@ openstack_ceilometer_git_install_branch: master
networking_ovn_git_repo: https://git.openstack.org/openstack/networking-ovn
networking_ovn_git_install_branch: master
# Developer mode
neutron_developer_mode: false
neutron_developer_constraints:
neutron_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')) }}"
neutron_git_constraints:
- "git+{{ neutron_git_repo }}@{{ neutron_git_install_branch }}#egg=neutron"
- "git+{{ neutron_fwaas_git_repo }}@{{ neutron_fwaas_git_install_branch }}#egg=neutron-fwaas"
- "git+{{ neutron_lbaas_git_repo }}@{{ neutron_lbaas_git_install_branch }}#egg=neutron-lbaas"
@ -89,25 +88,13 @@ neutron_developer_constraints:
- "git+{{ networking_bgpvpn_git_repo }}@{{ networking_bgpvpn_git_install_branch }}#egg=networking-bgpvpn"
- "git+{{ openstack_ceilometer_git_repo }}@{{ openstack_ceilometer_git_install_branch }}#egg=ceilometer"
- "git+{{ networking_ovn_git_repo }}@{{ networking_ovn_git_install_branch }}#egg=networking-ovn"
- "--constraint {{ neutron_upper_constraints_url }}"
# 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.
neutron_pip_install_args: >-
{{ neutron_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('') }}
neutron_pip_install_args: "{{ pip_install_options | default('') }}"
# Name of the virtual env to deploy into
neutron_venv_tag: "{{ venv_tag | default('untagged') }}"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
neutron_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/neutron.tgz
###
### Generic Neutron Config
###

View File

@ -90,7 +90,7 @@
- neutron-config
- name: Run the systemd service role
include_role:
import_role:
name: systemd_service
vars:
systemd_user_name: "{{ neutron_system_user_name }}"

View File

@ -46,8 +46,25 @@
delay: 2
with_items: "{{ neutron_remove_distro_packages }}"
- name: Install neutron packages from PIP
import_tasks: neutron_install_source.yml
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ neutron_git_constraints }}"
venv_install_destination_path: "{{ neutron_bin | dirname }}"
venv_install_distro_package_list: "{{ neutron_package_list }}"
venv_pip_install_args: "{{ neutron_pip_install_args }}"
venv_pip_packages: "{{ neutron_venv_packages }}"
venv_facts_when_changed:
- section: "neutron"
option: "need_db_expand"
value: "True"
- section: "neutron"
option: "need_db_contract"
value: "True"
- section: "neutron"
option: "venv_tag"
value: "{{ neutron_venv_tag }}"
when: neutron_install_method == 'source'
- name: Initialise the upgrade facts

View File

@ -1,62 +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 neutron_developer_constraints %}
{{ item }}
{% endfor %}
when: neutron_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ inventory_hostname }}"
when:
- neutron_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_install_destination_path: "{{ neutron_bin | dirname }}"
venv_install_distro_package_list: "{{ neutron_package_list }}"
venv_pip_install_args: "{{ neutron_pip_install_args }}"
venv_pip_packages: >-
{{ neutron_pip_packages | union(neutron_user_pip_packages) +
(neutron_bgp | bool) | ternary(neutron_optional_bgp_pip_packages, []) +
(neutron_fwaas | bool) | ternary(neutron_optional_fwaas_pip_packages, []) +
(neutron_fwaas_v2 | bool) | ternary(neutron_optional_fwaas_pip_packages, []) +
(neutron_lbaasv2 | bool) | ternary(neutron_optional_lbaas_pip_packages, []) +
(neutron_vpnaas | bool) | ternary(neutron_optional_vpnaas_pip_packages, []) +
(neutron_sfc | bool) | ternary(neutron_optional_sfc_pip_packages, []) +
(neutron_oslomsg_amqp1_enabled | bool) | ternary(neutron_optional_oslomsg_amqp1_pip_packages, []) }}
venv_facts_when_changed:
- section: "neutron"
option: "need_db_expand"
value: "True"
- section: "neutron"
option: "need_db_contract"
value: "True"
- section: "neutron"
option: "venv_tag"
value: "{{ neutron_venv_tag }}"

View File

@ -13,29 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install Calico pip packages
pip:
name: "{{ neutron_optional_calico_pip_packages }}"
state: "{{ neutron_pip_package_state }}"
virtualenv: "{{ neutron_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: >-
{{ neutron_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
when:
- neutron_services['neutron-server']['group'] in group_names
or neutron_services['calico-felix']['group'] in group_names
or neutron_services['calico-dhcp-agent']['group'] in group_names
notify: Restart neutron services
tags:
- calico-install
- calico-pip-packages
- name: Install Calico Felix agent
get_url:
url: "{{ calico_felix_url }}"

View File

@ -1,25 +0,0 @@
---
# Copyright 2016 Nuage Networks
#
# 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 nuage neutron pip packages
pip:
name: "{{ neutron_proprietary_nuage_pip_packages }}"
state: "{{ neutron_pip_package_state }}"
virtualenv: "{{ neutron_bin | dirname }}"
virtualenv_site_packages: "no"
retries: 5
delay: 2
when:
- neutron_services['neutron-server']['group'] in group_names

View File

@ -13,32 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Set the packages to install
set_fact:
neutron_optional_combined_pip_packages: |-
{% set packages = neutron_optional_opendaylight_pip_packages %}
{% if 'sfc' in neutron_plugin_base %}
{% set _ = packages.extend(neutron_optional_sfc_pip_packages) %}
{% endif %}
{{ packages }}
- name: Install OpenDaylight pip packages
pip:
name: "{{ neutron_optional_combined_pip_packages }}"
state: "{{ neutron_pip_package_state }}"
virtualenv: "{{ neutron_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: >-
{{ neutron_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:
- opendaylight-install
- opendaylight-pip-packages
- import_tasks: setup_ovs_opendaylight.yml
when: neutron_services['neutron-server']['group'] not in group_names

View File

@ -14,29 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install OVN pip packages
pip:
name: "{{ neutron_optional_ovn_pip_packages }}"
state: "{{ neutron_pip_package_state }}"
virtualenv: "{{ neutron_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: >-
{{ neutron_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:
- neutron_services['neutron-server']['group'] in group_names
or neutron_services['neutron-ovn-northd']['group'] in group_names
or neutron_services['neutron-ovn-controller']['group'] in group_names
notify: Restart neutron services
tags:
- ovn-install
- ovn-pip-packages
- name: Install ovn-northd packages
package:
name: "{{ neutron_ovn_northd_distro_packages }}"

View File

@ -73,6 +73,51 @@ neutron_proprietary_nuage_pip_packages:
neutron_optional_ovn_pip_packages:
- networking-ovn
neutron_venv_packages: >-
{%- set pkg_list = neutron_pip_packages | union(neutron_user_pip_packages) %}
{%- if neutron_bgp | bool %}
{%- set _ = pkg_list.extend(neutron_optional_bgp_pip_packages) %}
{%- endif %}
{%- if (neutron_fwaas | bool) or (neutron_fwaas_v2 | bool) %}
{%- set _ = pkg_list.extend(neutron_optional_fwaas_pip_packages) %}
{%- endif %}
{%- if neutron_lbaasv2 | bool %}
{%- set _ = pkg_list.extend(neutron_optional_lbaas_pip_packages) %}
{%- endif %}
{%- if neutron_vpnaas | bool %}
{%- set _ = pkg_list.extend(neutron_optional_vpnaas_pip_packages) %}
{%- endif %}
{%- if neutron_sfc | bool %}
{%- set _ = pkg_list.extend(neutron_optional_sfc_pip_packages) %}
{%- endif %}
{%- if neutron_oslomsg_amqp1_enabled | bool %}
{%- set _ = pkg_list.extend(neutron_optional_oslomsg_amqp1_pip_packages) %}
{%- endif %}
{%- if (neutron_plugin_type.split('.')[-1] == 'calico') and
((neutron_services['neutron-server']['group'] in group_names) or
(neutron_services['calico-felix']['group'] in group_names) or
(neutron_services['calico-dhcp-agent']['group'] in group_names)) %}
{%- set _ = pkg_list.extend(neutron_optional_calico_pip_packages) %}
{%- endif %}
{%- if (neutron_plugin_type.split('.')[-1] == 'nuage') and
(neutron_services['neutron-server']['group'] in group_names) %}
{%- set _ = pkg_list.extend(neutron_optional_nuage_pip_packages) %}
{%- endif %}
{%- if neutron_plugin_type.split('.')[-1] == 'opendaylight' %}
{%- set _ = pkg_list.extend(neutron_optional_opendaylight_pip_packages) %}
{%- if 'sfc' in neutron_plugin_base %}
{%- set _ = pkg_list.extend(neutron_optional_sfc_pip_packages) %}
{%- endif %}
{%- endif %}
{%- if (neutron_plugin_type.split('.')[-1] == 'ovn') and
((neutron_services['neutron-server']['group'] in group_names) or
(neutron_services['neutron-ovn-northd']['group'] in group_names) or
(neutron_services['neutron-ovn-controller']['group'] in group_names)) %}
{%- set _ = pkg_list.extend(neutron_optional_ovn_pip_packages) %}
{%- endif %}
{{- pkg_list | unique }}
###
### Generic Neutron Config
###

View File

@ -63,5 +63,3 @@ neutron_package_list: |-
{{ packages }}
neutron_bin: "/openstack/venvs/neutron-{{ neutron_venv_tag }}/bin"
neutron_venv_download: "{{ not neutron_developer_mode | bool }}"