Skip to content

Commit

Permalink
network: Try removing as many changes as possible during network cleanup
Browse files Browse the repository at this point in the history
In case an error is encountered while removing a network endpoint during
network cleanup, we cuurently return immediately with the error.
With this change, in case of error we simply log the error and proceed
towards removing the next endpoint. With this, we can cleanup the
network changes made by the shim as much as possible.
This is especially important when multiple interfaces are passed to the
network namespace using a network plugin like multus.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
  • Loading branch information
amshinde authored and Archana Shinde committed Feb 15, 2024
1 parent 24f5e87 commit 7248ec8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/runtime/virtcontainers/network_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,12 @@ func (n *LinuxNetwork) RemoveEndpoints(ctx context.Context, s *Sandbox, endpoint
}

if err := n.removeSingleEndpoint(ctx, s, ep, hotplug); err != nil {
return err
// Log the error instead of returning right away
// Proceed to remove the next endpoint so as to clean the network setup as
// much as possible.
// This is crucial for physical endpoints as we want to bind back the physical
// interface to its original host driver.
networkLogger().Warnf("Error removing endpoint %v : %v", ep.Name(), err)
}
}

Expand Down

0 comments on commit 7248ec8

Please sign in to comment.