Skip to content

Commit

Permalink
NetworkManager: only set secondary interfaces as up (#378)
Browse files Browse the repository at this point in the history
The primary interface will already be up, by doing "conn up" we are
forcing primary interface to be "reloaded" twice as we just reloaded
the configuration with "conn reload" - by double "reloading" the
primary interface we are forcing it to be unavailable longer than we
need it to.
  • Loading branch information
dorileo authored Mar 12, 2024
1 parent fb226cb commit dd285ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions google_guest_agent/network/manager/network_manager_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func (n networkManager) SetupEthernetInterface(ctx context.Context, config *cfg.
return fmt.Errorf("error reloading NetworkManager config cache: %v", err)
}

// Enable the new connections.
for _, ifname := range interfaces {
// Enable the new connections. Ignore the primary interface as it will already be up.
for _, ifname := range interfaces[1:] {
if err = run.Quiet(ctx, "nmcli", "conn", "up", "ifname", ifname); err != nil {
return fmt.Errorf("error enabling connection %s: %v", ifname, err)
}
Expand Down

0 comments on commit dd285ef

Please sign in to comment.