Skip to content

Commit

Permalink
debian_hypervisor: synchronize team0_x port state with OVS
Browse files Browse the repository at this point in the history
On hypervisor shutdown, OVS is stopped a long time before the team0_x
ports are shutdown as well.

In the meantime:
* The switching done by OVS is stopped
* The corosync totem stops circulating and nodes are disconnected from
  the pacemake cluster which leads to resources being stopped.
* After a while, RTSP detects this and change ports configuration to
  avoid the shutdown node and corosync/pacemaker start back with the
  left nodes.

To avoid this, use systemd services to shutdown team0_x ports as soon as
OVS is stopped to signal RTSP to change the configuration "instantly"
and thus, avoid the corosync totem timeout.

Signed-off-by: Yoann Congal <[email protected]>
  • Loading branch information
ycongal-smile committed Dec 14, 2024
1 parent e7523b2 commit 528e561
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
20 changes: 20 additions & 0 deletions roles/debian_hypervisor/files/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Systemd unit wrapping around team0_* ports.
# This can be used to synchronize ports link state with the service that use
# them.

[Unit]
After=network.target
DefaultDependencies=false
Conflicts=shutdown.target
Before=shutdown.target
StopWhenUnneeded=true

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=networkctl up %i
ExecStop=networkctl down %i

[Install]
# empty: This unit must be activated via Wants/Requires of other units that need
# it
10 changes: 9 additions & 1 deletion roles/debian_hypervisor/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,17 @@
group: root
mode: 0644
register: ovsvswitchd
- name: Copy [email protected] file
ansible.builtin.copy:
src: [email protected]
dest: /etc/systemd/system/[email protected]
owner: root
group: root
mode: 0644
register: team0_x_service
- name: Restart ovs-vswitchd
ansible.builtin.systemd:
state: restarted
daemon_reload: yes
name: ovs-vswitchd
when: ovsvswitchd.changed
when: ovsvswitchd.changed or team0_x_service.changed
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[Service]
Slice=ovs.slice

[Unit]
Requires=team0_x@{{team0_0}}.service
Requires=team0_x@{{team0_1}}.service

0 comments on commit 528e561

Please sign in to comment.