mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-5927. Storage garbage collector is trying to destroy the SSVM/CPVM root disk that is in use.
In case of VMware VM during root volume preparation if we are switching to a new volume, force expunge root disk that was created from the old template.
Because otherwise storage garbage collector will later try to expunge the old disk marked for expunge and fail with 'Cannot delete file' exception
since in VMware the new root vmdk has the same name and is now in use.
(cherry picked from commit 94ea2736f4)
Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
This commit is contained in:
parent
e53a9d9c56
commit
c14941edf8
|
|
@ -808,7 +808,16 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||
} catch (NoTransitionException e) {
|
||||
s_logger.debug("Unable to destroy existing volume: " + e.toString());
|
||||
}
|
||||
|
||||
// In case of VMware VM will continue to use the old root disk until expunged, so force expunge old root disk
|
||||
if (vm.getHypervisorType() == HypervisorType.VMware) {
|
||||
s_logger.info("Expunging volume " + existingVolume.getId() + " from primary data store");
|
||||
AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volFactory.getVolume(existingVolume.getId()));
|
||||
try {
|
||||
future.get();
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Failed to expunge volume:" + existingVolume.getId(), e);
|
||||
}
|
||||
}
|
||||
return newVolume;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -363,9 +363,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
// restoreVM - move the new ROOT disk into corresponding VM folder
|
||||
String vmInternalCSName = volume.getVmName();
|
||||
if (dsMo.folderExists(String.format("[%s]", dsMo.getName()), vmInternalCSName)) {
|
||||
String oldRootDisk = VmwareStorageLayoutHelper.getVmwareDatastorePathFromVmdkFileName(dsMo, vmInternalCSName, vmdkFileBaseName);
|
||||
if (oldRootDisk != null)
|
||||
VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dcMo, vmInternalCSName, dsMo, vmdkFileBaseName);
|
||||
VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dcMo, vmInternalCSName, dsMo, vmdkName);
|
||||
}
|
||||
|
||||
VolumeObjectTO newVol = new VolumeObjectTO();
|
||||
|
|
|
|||
Loading…
Reference in New Issue