mirror of https://github.com/apache/cloudstack.git
Fix migrateVMwithVolumes API in case of multiple volumes on VMware (#4480)
Problem: When migrateVMwithVolumes API is tried on a VM with two volumes to migrate to a different host and tried to migrate only one volume, Cloudstack migrates both the Volumes but then marks only one of them migrated. This makes volume inaccessible due to inconsitency in path of volume in cloudstack and vsphere Solution: Set the target datastore in relocate spec properly for each volume
This commit is contained in:
parent
492962238e
commit
51034be270
|
|
@ -4694,7 +4694,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
}
|
||||
|
||||
diskLocator = new VirtualMachineRelocateSpecDiskLocator();
|
||||
diskLocator.setDatastore(morDsAtSource);
|
||||
diskLocator.setDatastore(morTgtDatastore);
|
||||
Pair<VirtualDisk, String> diskInfo = getVirtualDiskInfo(vmMo, appendFileType(volume.getPath(), VMDK_EXTENSION));
|
||||
String vmdkAbsFile = getAbsoluteVmdkFile(diskInfo.first());
|
||||
if (vmdkAbsFile != null && !vmdkAbsFile.isEmpty()) {
|
||||
|
|
@ -4717,9 +4717,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
diskLocators.add(diskLocator);
|
||||
}
|
||||
}
|
||||
if (srcHyperHost.getHyperHostCluster().equals(tgtHyperHost.getHyperHostCluster())) {
|
||||
relocateSpec.getDisk().addAll(diskLocators);
|
||||
}
|
||||
relocateSpec.getDisk().addAll(diskLocators);
|
||||
|
||||
// Prepare network at target before migration
|
||||
NicTO[] nics = vmTo.getNics();
|
||||
|
|
|
|||
Loading…
Reference in New Issue