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

Clean importer pods on success #588

Merged
merged 1 commit into from
Oct 4, 2023
Merged

Conversation

liranr23
Copy link
Member

@liranr23 liranr23 commented Sep 7, 2023

Multiple importer pods may be created during warm migrations. This patch
cleans up all of them for the migrated VM once the migration completes
successfully.
This becomes handy once a user wishes to delete a migrated VM including
its disks. In such case, there would be no importer pods that prevent the
PVC and PV from being removed.

@liranr23 liranr23 requested a review from ahadas as a code owner September 7, 2023 06:39
@liranr23 liranr23 requested review from bennyz and bkhizgiy September 7, 2023 06:39
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/migration.go Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
@@ -748,14 +748,15 @@ func (r *Migration) execute(vm *plan.VMStatus) (err error) {
// Removing unnecessary DataVolumes
err = r.kubevirt.DeleteDataVolumes(vm)
if err != nil {
step.AddError(err.Error())
Copy link
Member

@ahadas ahadas Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about separating out the changes here and below to a different PR? I don't understand why skipping the call to step.AddError and the changes below also don't make much sense (setting error in line 751 and then proceeding to 753 that could override it)

@ahadas
Copy link
Member

ahadas commented Sep 26, 2023

@liranr23 I also rephrased the description of the PR, please change the commit message as well

@liranr23 liranr23 force-pushed the importer_pods branch 2 times, most recently from fa9ca40 to 6b6d0ec Compare October 1, 2023 12:36
Copy link
Member

@ahadas ahadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comments inside are rather minor but this PR includes two changes:

  1. remove multiple importer pods by a PVC
  2. remove importer pods when posting the vm so that the PV and PVC would be removed when removing the VM

only the first part is documented in the commit message
I'd prefer to separate this PR to two different PRs for each of them but it's also ok to extend the commit message to cover both..

pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
@liranr23 liranr23 force-pushed the importer_pods branch 2 times, most recently from 20deb30 to 6774f8b Compare October 4, 2023 11:51
@ahadas
Copy link
Member

ahadas commented Oct 4, 2023

@liranr23 the changes look good
I've updated the description of the PR based on the commit message and fixed the phrasing - please change the commit message

Multiple importer pods may be created during warm migrations. This patch
cleans up all of them for the migrated VM once the migration completes
successfully.
This becomes handy once a user wishes to delete a migrated VM including
its disks. In such case, there would be no importer pods that prevent the
PVC and PV from being removed.

Signed-off-by: Liran Rotenberg <[email protected]>
@sonarcloud
Copy link

sonarcloud bot commented Oct 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
6.9% 6.9% Duplication

@ahadas ahadas merged commit d12046a into kubev2v:main Oct 4, 2023
8 checks passed
@ahadas ahadas added this to the v2.5.2 milestone Oct 4, 2023
@liranr23 liranr23 deleted the importer_pods branch October 5, 2023 06:31
@ahadas ahadas removed this from the 2.5.2 milestone Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants