mirror of https://github.com/apache/cloudstack.git
bug 9827: call destroyVolume() method only after ensuring that the volume is not destroyed already.
status 9827: resolved fixed also added an assert to the method itself to throw a warn if the method is called for destroyed volume
This commit is contained in:
parent
ab576308a2
commit
ac8c79314d
|
|
@ -1686,6 +1686,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
@Override
|
||||
@DB
|
||||
public void destroyVolume(VolumeVO volume) throws ConcurrentOperationException {
|
||||
assert (volume.getState() != Volume.State.Destroy) : "Why destroy method is called for the volume that is already destroyed?";
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
|
|
|
|||
|
|
@ -1541,7 +1541,9 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
List<VolumeVO> volumesForThisVm = _volsDao.findByInstance(vm.getId());
|
||||
for(VolumeVO volume : volumesForThisVm) {
|
||||
try {
|
||||
_storageMgr.destroyVolume(volume);
|
||||
if (volume.getState() != Volume.State.Destroy) {
|
||||
_storageMgr.destroyVolume(volume);
|
||||
}
|
||||
if (volume.getState() == Volume.State.Ready) {
|
||||
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VOLUME_DELETE, volume.getAccountId(), volume.getDataCenterId(), volume.getId(),
|
||||
volume.getName());
|
||||
|
|
|
|||
Loading…
Reference in New Issue