From 61cd24091858e617ff63b7a37983f75efeed861b Mon Sep 17 00:00:00 2001 From: Danila Balagansky Date: Sun, 4 Sep 2022 18:43:30 +0300 Subject: [PATCH] Disable/stop/mask Open vSwitch on ovn-northd nodes There is no need to configure and run Open vSwitch (data-plane) services on `neutron-ovn-northd` (control-plane) nodes. Change-Id: I6fdc5b0e212a8b21fc576639a2a82dfe3324244e --- handlers/main.yml | 4 +++- tasks/neutron_install.yml | 7 ++++--- tasks/providers/ovn_config.yml | 9 --------- tasks/providers/setup_ovs_ovn.yml | 3 +-- vars/main.yml | 2 ++ 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 23108d85..e4c5d800 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -76,7 +76,9 @@ state: restarted listen: - "Restart provider services" - when: neutron_needs_openvswitch | bool + when: + - neutron_needs_openvswitch | bool + - not _neutron_ovs_disabled - name: Symlink neutron config directory file: diff --git a/tasks/neutron_install.yml b/tasks/neutron_install.yml index b1f56ed7..9ec30329 100644 --- a/tasks/neutron_install.yml +++ b/tasks/neutron_install.yml @@ -106,11 +106,12 @@ ('need_db_expand' not in ansible_local['openstack_ansible']['neutron']) or ('need_db_contract' not in ansible_local['openstack_ansible']['neutron']) -- name: Ensure Open vSwitch service is started and enabled +- name: Ensure Open vSwitch service state is set according to node group service: name: "{{ neutron_ovs_service_name }}" - state: started - enabled: yes + state: "{{ _neutron_ovs_disabled | ternary('stopped', 'started') }}" + enabled: "{{ _neutron_ovs_disabled | ternary(false, true) }}" + masked: "{{ _neutron_ovs_disabled | ternary(true, omit) }}" when: neutron_needs_openvswitch | bool # NOTE(hwoarang) contains may share the same physical host so we only diff --git a/tasks/providers/ovn_config.yml b/tasks/providers/ovn_config.yml index 6986e290..042e8f8e 100644 --- a/tasks/providers/ovn_config.yml +++ b/tasks/providers/ovn_config.yml @@ -40,15 +40,6 @@ when: - neutron_services['neutron-ovn-controller']['group'] in group_names -- name: Ensure Open vSwitch service is started and enabled - systemd: - name: "{{ neutron_ovs_service_name }}" - state: started - enabled: yes - when: - - neutron_services['neutron-ovn-northd']['group'] in group_names - or neutron_services['neutron-ovn-controller']['group'] in group_names - - name: Ensure ovn-northd service is started and enabled systemd: name: "{{ neutron_ovn_northd_service_name }}" diff --git a/tasks/providers/setup_ovs_ovn.yml b/tasks/providers/setup_ovs_ovn.yml index 74624c84..6d7f99eb 100644 --- a/tasks/providers/setup_ovs_ovn.yml +++ b/tasks/providers/setup_ovs_ovn.yml @@ -17,8 +17,7 @@ - name: Set openvswitch hostname command: "ovs-vsctl set open_vswitch . external-ids:hostname='{{ ansible_facts['nodename'] }}'" when: - - (neutron_services['neutron-ovn-northd']['group'] in group_names) or - (neutron_services['neutron-ovn-controller']['group'] in group_names) + - (neutron_services['neutron-ovn-controller']['group'] in group_names) # (NOTE) This makes all computes eligible to be gateway nodes - name: Set CMS Options for Gateway Scheduling diff --git a/vars/main.yml b/vars/main.yml index daa8bf48..7b3c8848 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -265,6 +265,8 @@ _neutron_non_tunnel_types: - vlan - local +_neutron_ovs_disabled: "{{ (neutron_services['neutron-ovn-northd']['group'] in group_names) and (neutron_services['neutron-ovn-controller']['group'] not in group_names) }}" + # Tunnel network types used by the OVS agent neutron_tunnel_types: "{{ neutron_ml2_drivers_type.split(',') | difference(_neutron_non_tunnel_types) | join(',') }}"