Description
The best_match_flavor module currently includes the flavor's root disk size (flavor.Disk) in the distance calculation when finding the best matching flavor. However, since the toolkit exclusively uses boot-from-volume for instance creation, the flavor's root disk property is irrelevant and should be excluded from the matching algorithm.
Problem
The current flavorDistance function calculates the "distance" between a flavor and VM requirements using vCPU, RAM, and disk:
func flavorDistance(flavor *flavors.Flavor, guestInfo *GuestInfo, diskCapacityMb int) int { vcpuDiff := int(math.Abs(float64(flavor.VCPUs - guestInfo.HwProcessorCount))) ramDiff := int(math.Abs(float64(flavor.RAM - guestInfo.HwMemtotalMb))) diskDiff := int(math.Abs(float64(flavor.Disk - diskCapacityMb))) return vcpuDiff + ramDiff + diskDiff}
https://github.com/os-migrate/vmware-migration-kit/blame/9263692d7c7f35b0136ce0d62f83919f9e85e5a3/plugins/modules/src/best_match_flavor/best_match_flavor.go#L103
This causes issues because:
- Boot-from-volume ignores the flavor's root disk: When booting from a Cinder volume, the flavor.Disk value refers to an ephemeral root disk that is never created or used.
- Suboptimal flavor selection: The algorithm may reject or deprioritize a perfectly suitable flavor (correct vCPU and RAM) simply because its disk value doesn't match the VM's disk size.
- Customer confusion: Users report that the toolkit "requires" a flavor with a root disk size matching their VM, even though that disk space is never actually used.
Description
The best_match_flavor module currently includes the flavor's root disk size (flavor.Disk) in the distance calculation when finding the best matching flavor. However, since the toolkit exclusively uses boot-from-volume for instance creation, the flavor's root disk property is irrelevant and should be excluded from the matching algorithm.
Problem
The current flavorDistance function calculates the "distance" between a flavor and VM requirements using vCPU, RAM, and disk:
func flavorDistance(flavor *flavors.Flavor, guestInfo *GuestInfo, diskCapacityMb int) int { vcpuDiff := int(math.Abs(float64(flavor.VCPUs - guestInfo.HwProcessorCount))) ramDiff := int(math.Abs(float64(flavor.RAM - guestInfo.HwMemtotalMb))) diskDiff := int(math.Abs(float64(flavor.Disk - diskCapacityMb))) return vcpuDiff + ramDiff + diskDiff}https://github.com/os-migrate/vmware-migration-kit/blame/9263692d7c7f35b0136ce0d62f83919f9e85e5a3/plugins/modules/src/best_match_flavor/best_match_flavor.go#L103
This causes issues because: