Skip to content

Commit

Permalink
snap/hooks/pre-refresh: Add timeout to *-appctl calls.
Browse files Browse the repository at this point in the history
In the event the `ovn-controller` or `ovs-vswitchd` daemons fail
to service a request on the control socket, the appctl program may
hang indefinitely.

Add the `--timeout` option to the *-appctl calls to avoid this
problem.

Closes-Bug: #2045865
Signed-off-by: Frode Nordahl <[email protected]>
(cherry picked from commit c5e5a2c)
  • Loading branch information
fnordahl committed Dec 7, 2023
1 parent 1d18f95 commit 9df9682
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions snap/hooks/pre-refresh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/bin/sh

# The amout of time to wait in seconds for the case where the app socket
# accepts connections and the daemon for some reason does not service requests.
TIMEOUT=30

# NOTE(fnordahl): tell the ovn-controller to exit without cleaning up flows nor
# SB DB state on refresh.
${SNAP}/commands/ovn-appctl exit --restart || true
${SNAP}/commands/ovn-appctl --timeout ${TIMEOUT} exit --restart || true

# Note (mkalcok): `microovn.switch` service, by default, stops OVS
# vswitch daemon with `--cleanup` flag that releases datapath
# resources like ports and bridges. This hook prevents such behavior
# by stopping the daemon without `--cleanup` flag during the snap
# refresh.

${SNAP}/commands/ovs-appctl exit || true
${SNAP}/commands/ovs-appctl --timeout ${TIMEOUT} exit || true

0 comments on commit 9df9682

Please sign in to comment.