Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up OVS bridge #1545

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions nodes/ovs/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,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