Skip to content

Commit

Permalink
Cleaning up OVS bridge (#1545)
Browse files Browse the repository at this point in the history
Co-authored-by: Pat Dumais <githum@dumais.io>
  • Loading branch information
pdumais and Pat Dumais committed Aug 22, 2023
1 parent 6ef4b49 commit d96ed77
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions nodes/ovs/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,24 @@ func (n *ovs) Deploy(_ context.Context, _ *nodes.DeployParams) error {

func (*ovs) PullImage(_ context.Context) error { return nil }
func (*ovs) GetImages(_ context.Context) map[string]string { return map[string]string{} }
func (*ovs) Delete(_ context.Context) error { return nil }
func (*ovs) DeleteNetnsSymlink() (err error) { return nil }

func (n *ovs) Delete(_ context.Context) error {
c := goOvs.New(
// Prepend "sudo" to all commands.
goOvs.Sudo(),
)

for _, ep := range n.GetEndpoints() {
// Under the hood, this is called with "--if-exists", so it will handle the case where it doesn't exist for some reason.
if err := c.VSwitch.DeletePort(n.Cfg.ShortName, ep.GetIfaceName()); err != nil {
log.Errorf("Could not remove OVS port %q from bridge %q", ep.GetIfaceName(), n.Config().ShortName)
}
}

return nil
}

func (*ovs) DeleteNetnsSymlink() (err error) { return nil }

// UpdateConfigWithRuntimeInfo is a noop for bridges.
func (*ovs) UpdateConfigWithRuntimeInfo(_ context.Context) error { return nil }
Expand Down

0 comments on commit d96ed77

Please sign in to comment.