From 4b940c8337017dcfb275f3eba90f4e8f5fa6dffc Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Mon, 29 Jan 2018 14:39:23 +0000 Subject: [PATCH] tasks: Ensure Open vSwitch is started for all providers that need it Previously, openvswitch was only started when we were using the ODL provider but we should start it for all providers that need it. As such we move the conditional which checks whether Open vSwitch is needed into a new variable and we use that to start/enable the service and also to install the package when needed. Change-Id: I4ec4fc2c2124a941f24478cbdf39ed34c0dce56f --- tasks/neutron_install.yml | 7 +++++++ tasks/providers/setup_ovs_opendaylight.yml | 6 ------ vars/main.yml | 13 +++++++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/tasks/neutron_install.yml b/tasks/neutron_install.yml index 283774f7..922a0527 100644 --- a/tasks/neutron_install.yml +++ b/tasks/neutron_install.yml @@ -179,3 +179,10 @@ - ansible_pkg_mgr in ['dnf', 'yum'] - ansible_selinux.status is defined - ansible_selinux.status == "enabled" + +- name: Ensure Open vSwitch service is started and enabled + service: + name: "{{ neutron_ovs_service_name }}" + state: started + enabled: yes + when: neutron_needs_openvswitch diff --git a/tasks/providers/setup_ovs_opendaylight.yml b/tasks/providers/setup_ovs_opendaylight.yml index 98a2be25..770b489f 100644 --- a/tasks/providers/setup_ovs_opendaylight.yml +++ b/tasks/providers/setup_ovs_opendaylight.yml @@ -13,12 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Ensure Open vSwitch service is started and enabled - service: - name: "{{ neutron_ovs_service_name }}" - state: started - enabled: yes - - name: Retrieve current OvS manager command: ovs-vsctl get-manager register: ovs_manager diff --git a/vars/main.yml b/vars/main.yml index 8101828e..583e1caa 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -13,6 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +### +### Open vSwitch +### +neutron_needs_openvswitch: (neutron_services['neutron-openvswitch-agent']['group'] in group_names and neutron_services['neutron-openvswitch-agent'].service_en | bool) + or (neutron_services['dragonflow-controller-agent']['group'] in group_names and neutron_services['dragonflow-controller-agent'].service_en | bool) + or (neutron_services['dragonflow-l3-agent']['group'] in group_names and neutron_services['dragonflow-l3-agent'].service_en | bool) + or ((neutron_services['neutron-server']['group'] not in group_names) and neutron_plugin_type == 'ml2.opendaylight') + ### ### Packages ### @@ -24,10 +32,7 @@ # neutron_package_list: |- {% set packages = neutron_distro_packages %} - {% if (neutron_services['neutron-openvswitch-agent']['group'] in group_names and neutron_services['neutron-openvswitch-agent'].service_en | bool) - or (neutron_services['dragonflow-controller-agent']['group'] in group_names and neutron_services['dragonflow-controller-agent'].service_en | bool) - or (neutron_services['dragonflow-l3-agent']['group'] in group_names and neutron_services['dragonflow-l3-agent'].service_en | bool) - or ((neutron_services['neutron-server']['group'] not in group_names) and neutron_plugin_type == 'ml2.opendaylight') %} + {% if neutron_needs_openvswitch %} {% if (ovs_nsh_support and ansible_pkg_mgr in ['apt', 'zypper']) %} {% set _ = packages.extend(neutron_ovs_nsh_required_packages) %} {% else %}