mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
bug 8247: when we have vms in error state, we destoy their volumes. then, when we delete account with such vms, we should NOT try and destroy vols already destroyed.
status 8247: resolved fixed
This commit is contained in:
parent
a8fb44a148
commit
447153f570
@ -2586,7 +2586,9 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
||||
txn.start();
|
||||
for (VolumeVO vol : volumesForVm) {
|
||||
if (vol.getVolumeType().equals(VolumeType.ROOT)) {
|
||||
destroyVolume(vol);
|
||||
//This check is for VM in Error state (volume is already destroyed)
|
||||
if(!vol.getState().equals(Volume.State.Destroy))
|
||||
destroyVolume(vol);
|
||||
toBeExpunged.add(vol);
|
||||
} else {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
||||
@ -72,6 +72,7 @@ import com.cloud.network.security.dao.SecurityGroupDao;
|
||||
import com.cloud.server.Criteria;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
@ -848,7 +849,8 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
||||
// Mark the account's volumes as destroyed
|
||||
List<VolumeVO> volumes = _volumeDao.findDetachedByAccount(accountId);
|
||||
for (VolumeVO volume : volumes) {
|
||||
_storageMgr.destroyVolume(volume);
|
||||
if(!volume.getState().equals(Volume.State.Destroy))//This check if for account with vm in error state; when a vm is in error state the vols are already destroyed on that account
|
||||
_storageMgr.destroyVolume(volume);
|
||||
}
|
||||
|
||||
//Cleanup security groups
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user