Skip to content

Commit c013f26

Browse files
committed
check underlay nic exist before config external bridge (#5520)
Signed-off-by: clyi <[email protected]>
1 parent bf37d40 commit c013f26

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/daemon/ovs.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,15 @@ func removeOvnMapping(name, key string) error {
234234
}
235235

236236
func (c *Controller) configExternalBridge(provider, bridge, nic string, exchangeLinkName, macLearningFallback bool) error {
237+
// check if nic exists before configuring external bridge
238+
nicExists, err := linkExists(nic)
239+
if err != nil {
240+
return fmt.Errorf("failed to check if nic %s exists: %w", nic, err)
241+
}
242+
if !nicExists {
243+
return fmt.Errorf("nic %s does not exist", nic)
244+
}
245+
237246
brExists, err := ovs.BridgeExists(bridge)
238247
if err != nil {
239248
return fmt.Errorf("failed to check OVS bridge existence: %w", err)

0 commit comments

Comments
 (0)