Skip to content

Commit

Permalink
underlay: get address/route before setting nm managed to no (#2592)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Apr 3, 2023
1 parent 250f340 commit f44ec54
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/daemon/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,6 @@ func changeProvideNicName(current, target string) (bool, error) {
return true, nil
}

// set link unmanaged by NetworkManager
if err = nmSetManaged(current, false); err != nil {
klog.Errorf("failed set device %s unmanaged by NetworkManager: %v", current, err)
return false, err
}

klog.Infof("renaming link %s as %s", current, target)
addresses, err := netlink.AddrList(link, netlink.FAMILY_ALL)
if err != nil {
klog.Errorf("failed to list addresses of link %s: %v", current, err)
Expand All @@ -216,6 +209,13 @@ func changeProvideNicName(current, target string) (bool, error) {
return false, err
}

// set link unmanaged by NetworkManager
if err = nmSetManaged(current, false); err != nil {
klog.Errorf("failed set device %s unmanaged by NetworkManager: %v", current, err)
return false, err
}

klog.Infof("renaming link %s as %s", current, target)
if err = netlink.LinkSetDown(link); err != nil {
klog.Errorf("failed to set link %s down: %v", current, err)
return false, err
Expand Down

0 comments on commit f44ec54

Please sign in to comment.