Bartosz Bezak 416574c8b4 Restart OVS container after hw-offload change
OpenvSwitch container needs to be restarted for hw offload to be
enabled/disabled properly [1].

OpenvSwitch container will also be restarted when system-id or
hostname changes.

Closes-Bug: #2076335

[1] https://docs.openstack.org/neutron/2024.1/admin/config-ovs-offload.html#configure-open-vswitch-hardware-offloading

Change-Id: I444fc345e5d21ed969f48aa9a6230905cc411149
2024-08-09 08:38:36 +00:00

54 lines
1.9 KiB
YAML

---
# NOTE(mnasiadka): external_ids:system-id uniquely identifies a physical system, used by OVN and other controllers
- name: Set system-id, hostname and hw-offload
become: true
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
user: root
module_name: openvswitch_db
module_args:
table: Open_vSwitch
record: .
col: "{{ item.col }}"
key: "{{ item.name }}"
value: "{{ item.value }}"
state: "{{ item.state | default('present') }}"
loop:
- { col: "external_ids", name: "system-id", value: "{{ openvswitch_system_id }}" }
- { col: "external_ids", name: "hostname", value: "{{ openvswitch_hostname }}" }
- { col: "other_config", name: "hw-offload", value: true, state: "{{ 'present' if openvswitch_hw_offload | bool else 'absent' }}" }
when:
- openvswitch_services['openvswitch-vswitchd'].host_in_groups | bool
notify:
- "Restart openvswitch-vswitchd container"
- name: Ensuring OVS bridge is properly setup
become: true
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
user: root
module_name: openvswitch_bridge
module_args:
bridge: "{{ item }}"
fail_mode: standalone
loop: "{{ neutron_bridge_name.split(',') }}"
when:
- inventory_hostname in groups["network"]
or (inventory_hostname in groups["compute"] and computes_need_external_bridge | bool )
- name: Ensuring OVS ports are properly setup
become: true
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
user: root
module_name: openvswitch_port
module_args:
bridge: "{{ item.0 }}"
port: "{{ item.1 }}"
with_together:
- "{{ neutron_bridge_name.split(',') }}"
- "{{ neutron_external_interface.split(',') }}"
when:
- inventory_hostname in groups["network"]
or (inventory_hostname in groups["compute"] and computes_need_external_bridge | bool )