Skip to content

Fix incorrect disk sizes during VMware VM import (backport #140)#141

Merged
votdev merged 4 commits into
v1.8from
mergify/bp/v1.8/pr-140
Mar 16, 2026
Merged

Fix incorrect disk sizes during VMware VM import (backport #140)#141
votdev merged 4 commits into
v1.8from
mergify/bp/v1.8/pr-140

Conversation

@mergify
Copy link
Copy Markdown

@mergify mergify Bot commented Mar 16, 2026

Problem:
When importing virtual machines from VMware vCenter, the vm-import-controller determines disk sizes using nfc.LeaseItem.Size. In some VMware environments this value represents the total provisioned capacity of the VM, not the size of the individual disk.

As a result, each imported disk may incorrectly receive the aggregate VM size, causing PVCs to be over-provisioned and migrations to fail due to insufficient storage.

Solution:
Disk capacities are now determined using the VM hardware configuration retrieved from: mo.VirtualMachine.Config.Hardware.Device For each VirtualDisk, the code reads: VirtualDisk.CapacityInKB and maps disks to lease items using the busNumber.

Related Issue:
harvester/harvester#10167

Test plan:

  1. Create a VM with multiple disks with different sizes.
  2. Create a VirtualMachineImport resource
  3. Check the disk sizes created in Harvester
  4. Disk sizes should now match the original VMware disk capacities.

Observations
on the previous PR, we couldn't match the key, so we now matching the busNumber since is unique per controller instance in hardware model.


This is an automatic backport of pull request #140 done by Mergify.

Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>
(cherry picked from commit d540117)
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>
(cherry picked from commit 2852e6a)
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>
(cherry picked from commit 6869512)
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>
(cherry picked from commit fd6f2e0)
@votdev votdev merged commit bf5ebf1 into v1.8 Mar 16, 2026
5 checks passed
@votdev votdev deleted the mergify/bp/v1.8/pr-140 branch March 16, 2026 09:23
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