mirror of https://github.com/apache/cloudstack.git
bug 9087: destroy the source volume, after update the volume entry
status 9087: resolved fixed
This commit is contained in:
parent
8ac36a980c
commit
7f12876be1
|
|
@ -1373,15 +1373,24 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
|
||||
String destPrimaryStorageVolumePath = cvAnswer.getVolumePath();
|
||||
String destPrimaryStorageVolumeFolder = cvAnswer.getVolumeFolder();
|
||||
|
||||
expungeVolume(volume);
|
||||
// Delete the volume on the source storage pool
|
||||
final DestroyCommand cmd = new DestroyCommand(srcPool, volume, null);
|
||||
|
||||
volume.setPath(destPrimaryStorageVolumePath);
|
||||
volume.setFolder(destPrimaryStorageVolumeFolder);
|
||||
volume.setPodId(destPool.getPodId());
|
||||
volume.setPoolId(destPool.getId());
|
||||
_volsDao.update(volume.getId(), volume);
|
||||
|
||||
|
||||
Answer destroyAnswer = null;
|
||||
try {
|
||||
destroyAnswer = sendToPool(srcPool, cmd);
|
||||
} catch (StorageUnavailableException e1) {
|
||||
throw new CloudRuntimeException("Failed to destroy the volume from the source primary storage pool to secondary storage.");
|
||||
}
|
||||
if (destroyAnswer == null || !destroyAnswer.getResult()) {
|
||||
throw new CloudRuntimeException("Failed to destroy the volume from the source primary storage pool to secondary storage.");
|
||||
}
|
||||
return _volsDao.findById(volume.getId());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue