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
This commit is contained in:
parent
f1ea4d0c19
commit
0f0dcc1964
|
|
@ -90,7 +90,6 @@ import com.cloud.dc.dao.ClusterDao;
|
|||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.event.ActionEvent;
|
||||
|
|
@ -1708,6 +1707,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();
|
||||
|
||||
|
|
@ -2902,6 +2902,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
return _storagePoolDao.findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateHostVO findVmTemplateHost(long templateId, long dcId, Long podId) {
|
||||
List<HostVO> secHosts = _hostDao.listSecondaryStorageHosts(dcId);
|
||||
if (secHosts.size() == 1) {
|
||||
|
|
|
|||
|
|
@ -1606,7 +1606,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());
|
||||
_usageEventDao.persist(usageEvent);
|
||||
|
|
|
|||
Loading…
Reference in New Issue