From 7ef57965007b694c6bc8cfc748bd39d89f999574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Mon, 14 Oct 2024 12:09:19 +0200 Subject: [PATCH] fix: improve error messages for invalid bridge/bond configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add more details. Signed-off-by: Joakim NohlgÄrd Signed-off-by: Andrey Smirnov (cherry picked from commit 9e6f64df047527ecb42df5fdf5fd2f9767d21437) --- .../pkg/controllers/network/link_config.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/internal/app/machined/pkg/controllers/network/link_config.go b/internal/app/machined/pkg/controllers/network/link_config.go index 7ac4025677..a90f2bca1f 100644 --- a/internal/app/machined/pkg/controllers/network/link_config.go +++ b/internal/app/machined/pkg/controllers/network/link_config.go @@ -287,11 +287,13 @@ func (ctrl *LinkConfigController) processDevicesConfiguration(logger *zap.Logger if device.Bond() != nil { for idx, linkName := range device.Bond().Interfaces() { if bondData, exists := bondedLinks[linkName]; exists && bondData.F1 != device.Interface() { - logger.Sugar().Warnf("link %q is included into more than two bonds", linkName) + logger.Sugar().Warnf("link %q is included in both bonds %q and %q", linkName, + bondData.F1, device.Interface()) } - if bridgeIface, exists := bridgedLinks[linkName]; exists && bridgeIface != device.Interface() { - logger.Sugar().Warnf("link %q is included into both a bond and a bridge", linkName) + if bridgeName, exists := bridgedLinks[linkName]; exists { + logger.Sugar().Warnf("link %q is included in both bond %q and bridge %q", linkName, + bridgeName, device.Interface()) } bondedLinks[linkName] = ordered.MakePair(device.Interface(), idx) @@ -300,12 +302,14 @@ func (ctrl *LinkConfigController) processDevicesConfiguration(logger *zap.Logger if device.Bridge() != nil { for _, linkName := range device.Bridge().Interfaces() { - if iface, exists := bridgedLinks[linkName]; exists && iface != device.Interface() { - logger.Sugar().Warnf("link %q is included into more than two bridges", linkName) + if bridgeName, exists := bridgedLinks[linkName]; exists && bridgeName != device.Interface() { + logger.Sugar().Warnf("link %q is included in both bridges %q and %q", linkName, + bridgeName, device.Interface()) } - if bondData, exists := bondedLinks[linkName]; exists && bondData.F1 != device.Interface() { - logger.Sugar().Warnf("link %q is included into both a bond and a bridge", linkName) + if bondData, exists := bondedLinks[linkName]; exists { + logger.Sugar().Warnf("link %q is included in both bond %q and bridge %q", linkName, + bondData.F1, device.Interface()) } bridgedLinks[linkName] = device.Interface()