From 1ee8637e659f5aaa013e56db4accb6268a36aaca Mon Sep 17 00:00:00 2001 From: Wesley Hershberger Date: Fri, 24 Jan 2025 10:19:32 +0200 Subject: [PATCH 1/3] udevadm: Ignore errors triggering devices Fixes LP: #2095203 Signed-off-by: Wesley Hershberger --- netplan_cli/cli/commands/apply.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netplan_cli/cli/commands/apply.py b/netplan_cli/cli/commands/apply.py index 7e17cee1f..bd42ebfc7 100644 --- a/netplan_cli/cli/commands/apply.py +++ b/netplan_cli/cli/commands/apply.py @@ -252,7 +252,11 @@ def command_apply(self, run_generate=True, sync=False, exit_on_error=True, state stderr=subprocess.DEVNULL) subprocess.check_call(['udevadm', 'control', '--reload']) - subprocess.check_call(['udevadm', 'trigger', '--action=move', '--subsystem-match=net', '--settle']) + + try: + subprocess.check_call(['udevadm', 'trigger', '--action=move', '--subsystem-match=net', '--settle']) + except subprocess.CalledProcessError as e: + logging.warning("Ignoring device trigger error: {}".format(e)) # apply any SR-IOV related changes, if applicable NetplanApply.process_sriov_config(config_manager, exit_on_error) From 640bbd8f5b8803901f640068187680923e150870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=A4rdian?= Date: Wed, 5 Feb 2025 14:06:59 +0100 Subject: [PATCH 2/3] cli:apply: use single-quotes in logging --- netplan_cli/cli/commands/apply.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netplan_cli/cli/commands/apply.py b/netplan_cli/cli/commands/apply.py index bd42ebfc7..63730ae34 100644 --- a/netplan_cli/cli/commands/apply.py +++ b/netplan_cli/cli/commands/apply.py @@ -256,7 +256,7 @@ def command_apply(self, run_generate=True, sync=False, exit_on_error=True, state try: subprocess.check_call(['udevadm', 'trigger', '--action=move', '--subsystem-match=net', '--settle']) except subprocess.CalledProcessError as e: - logging.warning("Ignoring device trigger error: {}".format(e)) + logging.warning('Ignoring device trigger error: {}'.format(e)) # apply any SR-IOV related changes, if applicable NetplanApply.process_sriov_config(config_manager, exit_on_error) From 8d1638b07ed5e6ff2c860ea414081cb2a3af79b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=A4rdian?= Date: Wed, 5 Feb 2025 14:11:05 +0100 Subject: [PATCH 3/3] cli:apply: add comment about udevadm trigger errors --- netplan_cli/cli/commands/apply.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netplan_cli/cli/commands/apply.py b/netplan_cli/cli/commands/apply.py index 63730ae34..ba17d306c 100644 --- a/netplan_cli/cli/commands/apply.py +++ b/netplan_cli/cli/commands/apply.py @@ -256,6 +256,8 @@ def command_apply(self, run_generate=True, sync=False, exit_on_error=True, state try: subprocess.check_call(['udevadm', 'trigger', '--action=move', '--subsystem-match=net', '--settle']) except subprocess.CalledProcessError as e: + # udevadm trigger returns 1 if it cannot trigger devices since + # systemd v248, e.g. in containers (LP: #2095203) logging.warning('Ignoring device trigger error: {}'.format(e)) # apply any SR-IOV related changes, if applicable