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-1966 | Allow to skip shared disks #1318

Merged
merged 2 commits into from
Feb 5, 2025
Merged

MTV-1966 | Allow to skip shared disks #1318

merged 2 commits into from
Feb 5, 2025

Conversation

mnecas
Copy link
Member

@mnecas mnecas commented Jan 27, 2025

Issue: When migrating a VM with shared disks the virt-v2v transfers all disks that are attached to the VM, that includes the shared disks. But if we will transfer 2 VMs with the same shared disk the disk will be migrated twice. This takes a lot of additional resources.

Fix: There are multiple solutions, which vary in complexity. I have chosen the simplest and fastest solution by adding a new Plan parameter migrateSharedDisks this determines if the shared disks should be migrated. By default, it's set to True as that's the default virt-v2v behaviour. If the toggle is turned off the plan will filter out the shared disks and use KubeVirt CDI for disk transfer and virt-v2v-in-place for the guest conversion.

Usage: The user will create 2 plans, one with only one VM and with the migrateSharedDisks enabled to transfer the shared disks, and another plan with the toggle disabled which will migrate the additional VMs. If the plans are in correct order (first transfer shared disk) the shared disks will get automatically attached to the new VMs.

Ref: http://issues.redhat.com/browse/MTV-1442

@mnecas mnecas requested a review from yaacov as a code owner January 27, 2025 07:50
@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 109 lines in your changes missing coverage. Please review.

Project coverage is 15.37%. Comparing base (f1fe5d0) to head (da29192).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/plan/adapter/vsphere/builder.go 0.00% 88 Missing ⚠️
pkg/controller/plan/kubevirt.go 0.00% 17 Missing ⚠️
pkg/controller/plan/migration.go 0.00% 2 Missing ⚠️
pkg/controller/plan/adapter/vsphere/client.go 0.00% 1 Missing ⚠️
pkg/controller/plan/scheduler/vsphere/scheduler.go 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1318      +/-   ##
==========================================
- Coverage   15.45%   15.37%   -0.09%     
==========================================
  Files         112      112              
  Lines       23377    23499     +122     
==========================================
  Hits         3613     3613              
- Misses      19479    19601     +122     
  Partials      285      285              
Flag Coverage Δ
unittests 15.37% <0.00%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mnecas
Copy link
Member Author

mnecas commented Jan 27, 2025

Test with 2 VMs, each had one own disk and one shared disk.
The plan shared-1 had the migrateSharedDisks: True and transferred both disks.
image

And the plan shared-2 had the migrateSharedDisks: False and transferred only non shared disks.
image

@mnecas mnecas added this to the 2.7.10 milestone Jan 28, 2025
@@ -723,6 +828,10 @@ func (r *Builder) mapDisks(vm *model.VM, vmRef ref.Ref, persistentVolumeClaims [
},
},
}
if disk.Shared {
kubevirtDisk.Shareable = ptr.To(true)
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is not needed. it's only needed one one disk is attached multiple times to the same vm.

Copy link
Member

@yaacov yaacov left a comment

Choose a reason for hiding this comment

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

lgtm, some nitpicks

@mnecas mnecas force-pushed the MTV-1442 branch 2 times, most recently from 8bd0ec4 to 6154d08 Compare February 5, 2025 09:50
Issue: When migrating a VM with shared disks the virt-v2v transfers all
disks that are attached to the VM, that includes the shared disks. But
if we will transfer 2 VMs with the same shared disk the disk will be
migrated twice. This takes a lot of additional resources.

Fix: There are multiple solutions, which vary in complexity. I have
chosen the simplest and fastest solution by adding a new Plan parameter
migrateSharedDisks this determines if the shared disks should be
migrated. By default, it's set to True as that's the default virt-v2v
behaviour. If the toggle is turned off the plan will filter out the
shared disks and use KubeVirt CDI for disk transfer and
virt-v2v-in-place for the guest conversion.

Ref: http://issues.redhat.com/browse/MTV-1442

Signed-off-by: Martin Necas <mnecas@redhat.com>
Signed-off-by: Martin Necas <mnecas@redhat.com>
Copy link

sonarqubecloud bot commented Feb 5, 2025

@mnecas mnecas merged commit a7ba4f9 into kubev2v:main Feb 5, 2025
13 of 16 checks passed
@mnecas mnecas mentioned this pull request Feb 5, 2025
@mnecas mnecas changed the title MTV-1442 | Allow to skip shared disks MTV-1966 | Allow to skip shared disks Feb 7, 2025
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.

4 participants