Handle volume copy from secondary to primary in case of vSAN

This commit is contained in:
Harikrishna Patnala 2020-08-17 01:49:09 +05:30
parent d48cab75ab
commit 0a412ac6da
2 changed files with 8 additions and 3 deletions

View File

@ -3483,7 +3483,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
throw new Exception("Unable to create container VM for volume creation");
}
clonedVm.moveAllVmDiskFiles(primaryDsMo, "", false);
clonedVm.moveAllVmDiskFiles(primaryDsMo, HypervisorHostHelper.VSPHERE_DATASTORE_BASE_FOLDER, false);
clonedVm.detachAllDisks();
return _storage.getSize(srcOVFFileName);
} finally {

View File

@ -260,8 +260,13 @@ public class DatastoreMO extends BaseMO {
destFullPath = String.format("[%s] %s", destDsName, destFilePath);
DatastoreMO srcDsMo = new DatastoreMO(_context, morDestDs);
if (!srcDsMo.fileExists(srcFullPath)) {
s_logger.error(String.format("Cannot move file to destination datastore due to file %s does not exists", srcFullPath));
try {
if (!srcDsMo.fileExists(srcFullPath)) {
s_logger.error(String.format("Cannot move file to destination datastore due to file %s does not exists", srcFullPath));
return false;
}
} catch (Exception e) {
s_logger.error(String.format("Cannot move file to destination datastore due to file %s due to exeception %s", srcFullPath, e.getMessage()));
return false;
}