forked from canonical/core-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change netplan apply to workaround LP#2058976
See also canonical/netplan#449
- Loading branch information
1 parent
353a77c
commit f4d5b1c
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
# Apply netplan patch (workaround for LP#2058976 | ||
patch -p0 -i /install-data/patch/netplan-apply.diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- ./usr/share/netplan/netplan/cli/commands/apply.py 2024-04-19 10:02:42.065447958 +0100 | ||
+++ ./usr/share/netplan/netplan/cli/commands/apply.py 2024-04-19 10:04:34.325809194 +0100 | ||
@@ -270,15 +270,20 @@ | ||
# exclude the special 'netplan-ovs-cleanup.service' unit | ||
netplan_ovs = [os.path.basename(f) for f in glob.glob('/run/systemd/system/*.wants/netplan-ovs-*.service') | ||
if not f.endswith('/' + OVS_CLEANUP_SERVICE)] | ||
- # Run 'systemctl start' command synchronously, to avoid race conditions | ||
+ # Run 'systemctl (re)start' command synchronously, to avoid race conditions | ||
# with 'oneshot' systemd service units, e.g. netplan-ovs-*.service. | ||
- try: | ||
- utils.networkctl_reload() | ||
- utils.networkctl_reconfigure(utils.networkd_interfaces()) | ||
- except subprocess.CalledProcessError: | ||
- # (re-)start systemd-networkd if it is not running, yet | ||
- logging.warning('Falling back to a hard restart of systemd-networkd.service') | ||
- utils.systemctl('restart', ['systemd-networkd.service'], sync=True) | ||
+ # | ||
+ # In the past, calls to networkctl_reload/networkctl_reconfigure | ||
+ # were tried, but due maybe to systemd-networkd bugs, they were not | ||
+ # working as expected: the interface was getting initially the | ||
+ # expected state, but after some minutes it ignored the state of | ||
+ # /run/systemd/network/ and used the configuration read when the | ||
+ # service was started. This happened in the case of removed | ||
+ # .network files. Looking at files in | ||
+ # /run/systemd/netif/links/<num>, the internal state seemed to keep | ||
+ # removed files in NETWORK_FILE= (see LP#2058976). | ||
+ logging.info('Restarting systemd-networkd.service') | ||
+ utils.systemctl('restart', ['systemd-networkd.service'], sync=True) | ||
# 1st: execute OVS cleanup, to avoid races while applying OVS config | ||
utils.systemctl('start', [OVS_CLEANUP_SERVICE], sync=True) | ||
# 2nd: start all other services |