Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2307,6 +2307,9 @@ private void markVolumesInPool(VMInstanceVO vm, StoragePool destPool, Answer[] h
VolumeVO volume = _volsDao.findById(result.getId());
volume.setPath(result.getPath());
volume.setPoolId(destPool.getId());
if (result.getChainInfo() != null) {
volume.setChainInfo(result.getChainInfo());
}
_volsDao.update(volume.getId(), volume);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4429,7 +4429,8 @@ private Answer migrateAndAnswer(VirtualMachineMO vmMo, String poolUuid,
} else {
s_logger.debug("Successfully consolidated disks of VM " + vmMo.getVmName() + ".");
}
return createAnswerForCmd(vmMo, poolUuid, cmd, volumeDeviceKey);
DatastoreMO dsMo = new DatastoreMO(getServiceContext(), morDs);
return createAnswerForCmd(vmMo, dsMo, cmd, volumeDeviceKey);
} else {
return new Answer(cmd, false, "failed to changes data store for VM" + vmMo.getVmName());
}
Expand All @@ -4440,7 +4441,7 @@ private Answer migrateAndAnswer(VirtualMachineMO vmMo, String poolUuid,
}
}

Answer createAnswerForCmd(VirtualMachineMO vmMo, String poolUuid, Command cmd, Map<Integer, Long> volumeDeviceKey) throws Exception {
Answer createAnswerForCmd(VirtualMachineMO vmMo, DatastoreMO dsMo, Command cmd, Map<Integer, Long> volumeDeviceKey) throws Exception {
List<VolumeObjectTO> volumeToList = new ArrayList<>();
VirtualMachineDiskInfoBuilder diskInfoBuilder = vmMo.getDiskInfoBuilder();
VirtualDisk[] disks = vmMo.getAllDiskDevice();
Expand All @@ -4458,7 +4459,7 @@ Answer createAnswerForCmd(VirtualMachineMO vmMo, String poolUuid, Command cmd, M
for (VirtualDisk disk : disks) {
VolumeObjectTO newVol = new VolumeObjectTO();
String newPath = vmMo.getVmdkFileBaseName(disk);
VirtualMachineDiskInfo diskInfo = diskInfoBuilder.getDiskInfoByBackingFileBaseName(newPath, poolUuid);
VirtualMachineDiskInfo diskInfo = diskInfoBuilder.getDiskInfoByBackingFileBaseName(newPath, dsMo.getName());
newVol.setId(volumeDeviceKey.get(disk.getKey()));
newVol.setPath(newPath);
newVol.setChainInfo(_gson.toJson(diskInfo));
Expand Down Expand Up @@ -4804,8 +4805,9 @@ protected Answer execute(MigrateWithStorageCommand cmd) {
if (volumeDeviceKey.get(volumeId) == disk.getKey()) {
VolumeObjectTO newVol = new VolumeObjectTO();
String newPath = vmMo.getVmdkFileBaseName(disk);
String poolName = entry.second().getUuid().replace("-", "");
VirtualMachineDiskInfo diskInfo = diskInfoBuilder.getDiskInfoByBackingFileBaseName(newPath, poolName);
ManagedObjectReference morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(tgtHyperHost, entry.second().getUuid());
DatastoreMO dsMo = new DatastoreMO(getServiceContext(), morDs);
VirtualMachineDiskInfo diskInfo = diskInfoBuilder.getDiskInfoByBackingFileBaseName(newPath, dsMo.getName());
newVol.setId(volumeId);
newVol.setPath(newPath);
newVol.setChainInfo(_gson.toJson(diskInfo));
Expand Down Expand Up @@ -5100,7 +5102,7 @@ private Answer execute(MigrateVolumeCommand cmd) {
}
}
VirtualMachineDiskInfoBuilder diskInfoBuilder = vmMo.getDiskInfoBuilder();
String chainInfo = _gson.toJson(diskInfoBuilder.getDiskInfoByBackingFileBaseName(volumePath, poolTo.getUuid().replace("-", "")));
String chainInfo = _gson.toJson(diskInfoBuilder.getDiskInfoByBackingFileBaseName(volumePath, targetDsMo.getName()));
MigrateVolumeAnswer answer = new MigrateVolumeAnswer(cmd, true, null, volumePath);
answer.setVolumeChainInfo(chainInfo);
return answer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@ public void syncDatastoreClusterStoragePool(long datastoreClusterPoolId, List<Mo
} else {
// This is to find datastores which are removed from datastore cluster.
// The final set childDatastoreUUIDs contains the UUIDs of child datastores which needs to be removed from datastore cluster
childDatastoreUUIDs.remove(childStoragePoolInfo.getUuid());
childDatastoreUUIDs.remove(dataStoreVO.getUuid());
}
} else {
dataStoreVO = createChildDatastoreVO(datastoreClusterPool, childDataStoreAnswer);
Expand Down