Skip to content

F #-: VRouter: VRRP: Hooks on role-changes - #415

Open
netaviator wants to merge 2 commits into
OpenNebula:masterfrom
netaviator:pr/vrouter-failover-hooks
Open

netaviator wants to merge 2 commits into
OpenNebula:masterfrom
netaviator:pr/vrouter-failover-hooks

Conversation

@netaviator

Copy link
Copy Markdown

Run the executables in /etc/one-appliance/ha-hooks.d/ in name order with "up" (the node became MASTER) or "down" (it became BACKUP).

Services that have to follow the VRRP role currently need a patch to the Failover module. Two examples: a routing daemon that makes the standby less attractive to its peers (a longer AS path or a higher metric) and undoes that on the master, and a connection-tracking sync daemon that asks its peer for a full resync on the standby. With hooks, such a service ships its own executable and the Failover module stays unchanged.

"up" hooks run after the stock services have been restarted, so forwarding does not wait for them. "down" hooks run first, before the stock services are stopped. "up" hooks see the VM context in their environment; "down" hooks do not and read it themselves if they need it.

A hook never breaks the failover: every failure is only logged. Each hook runs synchronously but bounded: its output goes to a file (not a pipe, so leftover children cannot block the failover), and a hook past 30s is killed together with its whole process group. Hooks run one after the other, so the worst case is the number of hooks times 30s.

netaviator added a commit to netaviator/one-apps that referenced this pull request Oct 20, 2026
The hooks are in PR OpenNebula#415. Also name the test image as a Docker image.

Signed-off-by: Jan Gilla <jgilla@level66.network>
netaviator added a commit to netaviator/one-apps that referenced this pull request Oct 20, 2026
The hooks are in PR OpenNebula#415. Also name the test image as a Docker image.

Signed-off-by: Jan Gilla <jgilla@level66.network>
Run the executables in /etc/one-appliance/ha-hooks.d/ in name order with
"up" (the node became MASTER) or "down" (it became BACKUP) once the
stock failover services have been switched.

Other services (a routing daemon, for example) can follow the VRRP role
without patching the Failover module. A hook never breaks the failover:
every failure is only logged. Each hook runs synchronously but bounded:
its output goes to a file (not a pipe, so leftover children cannot block
the failover) and a hook past 30s is killed together with its whole
process group.

Add the first unit tests for the Failover module (event handling and the
hooks: order, arguments, non-executable files, failing, hanging and
raising hooks).

Signed-off-by: Jan Gilla <jgilla@level66.network>
Describe what the service does on a role change and the contract of the
hooks in ha-hooks.d: arguments, order, environment, time limit, failure
handling and that a hook has to be safe to run twice.

Signed-off-by: Jan Gilla <jgilla@level66.network>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant