Skip to content

Commit

Permalink
sriov_apply: execute apply --sriov-only before network-pre.target
Browse files Browse the repository at this point in the history
When activating VF LAG and at the same time changing the e-switch mode
to switchdev, the e-switch change MUST be performed before the bonding.
Trying to change it after the bond is created will fail and the driver
will report that the e-switch is busy.

In fact, all the SR-IOV initial setup must happen before the networking
configuration.

Change the order in which we call netplan apply --sriov-only to happen
before network-pre.target.
  • Loading branch information
daniloegea committed Feb 23, 2024
1 parent 27346fc commit 2c82bb1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/sriov.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ write_sriov_apply_systemd_unit(GHashTable* pfs, const char* rootdir, GError** er

GString* s = g_string_new("[Unit]\n");
g_string_append(s, "Description=Apply SR-IOV configuration\n");
g_string_append_printf(s, "After=network.target\n");
g_string_append_printf(s, "Before=network-pre.target\n");

g_hash_table_iter_init(&iter, pfs);
while (g_hash_table_iter_next (&iter, &key, NULL)) {
Expand Down
8 changes: 4 additions & 4 deletions tests/test_sriov.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ def test_eswitch_mode(self):
ExecStart=/usr/sbin/netplan rebind --debug enblue engreen
''', 'apply.service': '''[Unit]
Description=Apply SR-IOV configuration
After=network.target
Before=network-pre.target
After=sys-subsystem-net-devices-enblue.device
After=sys-subsystem-net-devices-engreen.device
Expand Down Expand Up @@ -1166,7 +1166,7 @@ def test_rebind_service_generation(self):
ExecStart=/usr/sbin/netplan rebind --debug enblue engreen
''', 'apply.service': '''[Unit]
Description=Apply SR-IOV configuration
After=network.target
Before=network-pre.target
After=sys-subsystem-net-devices-enblue.device
After=sys-subsystem-net-devices-engreen.device
Expand All @@ -1186,7 +1186,7 @@ def test_rebind_not_delayed(self):
link: engreen''')
self.assert_sriov({'apply.service': '''[Unit]
Description=Apply SR-IOV configuration
After=network.target
Before=network-pre.target
After=sys-subsystem-net-devices-engreen.device
[Service]
Expand All @@ -1206,7 +1206,7 @@ def test_rebind_no_iface(self):
link: engreen''')
self.assert_sriov({'apply.service': '''[Unit]
Description=Apply SR-IOV configuration
After=network.target
Before=network-pre.target
[Service]
Type=oneshot
Expand Down

0 comments on commit 2c82bb1

Please sign in to comment.