vexxhost / migratekit

Near-live migration toolkit for VMware to OpenStack
Apache License 2.0
78 stars 11 forks source link

diskObjectId changed in VMware resulting in new full migration #38

Closed jmussmann closed 4 weeks ago

jmussmann commented 1 month ago

Sometimes the "diskObjectId" changes on the VMware site. Then migratekit does not find the corresponding volume and creates a new volume and starts a new full copy.

I can not explain yet why the "diskObjectId" changes but this value is also deprecated since vSphere 6.7.

Maybe it would be better to use the disk uuid or the device key. I am still investigating which disk parameter would be the most stable.

Here my testing code:

//...
var vmMo mo.VirtualMachine
err = vm.Properties(ctx, vm.Reference(), []string{"config"}, &vmMo)
if err != nil {
    return err
}
// Get disk information
for _, device := range vmMo.Config.Hardware.Device {
    if disk, ok := device.(*types.VirtualDisk); ok {
        log.Debugf("Disk DiskObjectId %s\n", disk.DiskObjectId)
        backing := disk.Backing.(*types.VirtualDiskFlatVer2BackingInfo)
        log.Debugf("Disk Filename: %s\n", backing.FileName)
        log.Debugf("Disk/Device Key: %d\n", disk.Key)
        log.Debugf("Disk UUID: %s\n", backing.Uuid)
        log.Debugf("Disk Change ID: %s\n", backing.ChangeId)
        log.Debugf("Disk Capacity: %d GB\n", disk.CapacityInBytes/1024/1024/1024)
    }
}
//...
DEBU[0000] Disk DiskObjectId 919-2000  <--- This changes sometimes, but only the prefix (the 919 part), the second part (seeams to be the device key) is stable                
DEBU[0000] Disk Filename: [VxRail-Virtual-SAN-Datastore-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX] XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/test-vm.vmdk 
DEBU[0000] Disk/Device Key: 2000                        
DEBU[0000] Disk UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 
DEBU[0000] Disk Change ID:                              
DEBU[0000] Disk Capacity: 100 GB

The VMs are located on a vSAN datastore.

progesde commented 1 month ago

I can acknowledge, while migrating VMs between Hosts the ID changes.

Before: 15696-2000

After: 13650-2000