Skip to content

Commit bc56bdf

Browse files
committed
fix: add warnings to 802.3ad bond
In case some settings are missing that might be impacting the usage of 802.3ad, present a warning to users. Signed-off-by: Mateusz Urbanek <mateusz.urbanek@siderolabs.com> (cherry picked from commit 7f1147b)
1 parent 54e5b43 commit bc56bdf

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

pkg/machinery/config/types/network/bond.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ func (s *BondConfigV1Alpha1) Validate(validation.RuntimeMode, ...validation.Opti
359359

360360
if s.BondMode == nil {
361361
errs = errors.Join(errs, errors.New("bond mode must be specified"))
362+
} else if *s.BondMode == nethelpers.BondMode8023AD {
363+
warnings = append(warnings, s.validateFor8023AD()...)
362364
}
363365

364366
extraWarnings, extraErrs := s.CommonLinkConfig.Validate()
@@ -367,6 +369,26 @@ func (s *BondConfigV1Alpha1) Validate(validation.RuntimeMode, ...validation.Opti
367369
return warnings, errs
368370
}
369371

372+
func (s *BondConfigV1Alpha1) validateFor8023AD() []string {
373+
const warn = " was not specified for 802.3ad bond"
374+
375+
var warnings []string
376+
377+
if s.BondMIIMon == nil {
378+
warnings = append(warnings, "miimon"+warn)
379+
}
380+
381+
if s.BondUpDelay == nil {
382+
warnings = append(warnings, "updelay"+warn)
383+
}
384+
385+
if s.BondDownDelay == nil {
386+
warnings = append(warnings, "downdelay"+warn)
387+
}
388+
389+
return warnings
390+
}
391+
370392
// Links implements NetworkBondConfig interface.
371393
func (s *BondConfigV1Alpha1) Links() []string {
372394
return s.BondLinks

pkg/machinery/config/types/network/bond_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ func TestBondValidate(t *testing.T) {
158158

159159
return cfg
160160
},
161+
162+
expectedWarnings: []string{
163+
"miimon was not specified for 802.3ad bond",
164+
"updelay was not specified for 802.3ad bond",
165+
"downdelay was not specified for 802.3ad bond",
166+
},
161167
},
162168
} {
163169
t.Run(test.name, func(t *testing.T) {

0 commit comments

Comments
 (0)