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.
This commit is contained in:
parent
d5e0dcd2a7
commit
94ea2736f4
|
|
@ -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