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

MTV-1929 Clean up unused active source connections. #1312

Merged
merged 2 commits into from
Jan 23, 2025
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
15 changes: 15 additions & 0 deletions pkg/controller/plan/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ func (r *Migration) begin() (err error) {
// Archive the plan.
// Best effort to remove any retained migration resources.
func (r *Migration) Archive() {
defer func() {
if r.provider != nil {
r.provider.Close()
}
}()
if err := r.init(); err != nil {
r.Log.Error(err, "Archive initialization failed.")
return
Expand Down Expand Up @@ -406,6 +411,11 @@ func (r *Migration) Archive() {
}

func (r *Migration) SetPopulatorDataSourceLabels() {
defer func() {
if r.provider != nil {
r.provider.Close()
}
}()
err := r.init()
if err != nil {
r.Log.Error(err, "Setting Populator Data Source labels failed.")
Expand Down Expand Up @@ -433,6 +443,11 @@ func (r *Migration) SetPopulatorDataSourceLabels() {
// Cancel the migration.
// Delete resources associated with VMs that have been marked canceled.
func (r *Migration) Cancel() error {
defer func() {
if r.provider != nil {
r.provider.Close()
}
}()
if err := r.init(); err != nil {
return liberr.Wrap(err)
}
Expand Down
Loading