mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-10223 Snapshots are not getting deleted when domain is deleted (#2399)
This commit is contained in:
parent
46c56eaaf9
commit
35e008df6c
|
|
@ -34,6 +34,8 @@ public interface VolumeDao extends GenericDao<VolumeVO, Long>, StateDao<Volume.S
|
|||
|
||||
List<VolumeVO> findByAccount(long accountId);
|
||||
|
||||
List<VolumeVO> findIncludingRemovedByAccount(long accountId);
|
||||
|
||||
Pair<Long, Long> getCountAndTotalByPool(long poolId);
|
||||
|
||||
Pair<Long, Long> getNonDestroyedCountAndTotalByPool(long poolId);
|
||||
|
|
|
|||
|
|
@ -96,6 +96,13 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> findIncludingRemovedByAccount(long accountId) {
|
||||
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> findByInstance(long id) {
|
||||
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
|
||||
|
|
|
|||
|
|
@ -715,7 +715,7 @@ public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implement
|
|||
@Override
|
||||
public boolean deleteSnapshotDirsForAccount(long accountId) {
|
||||
|
||||
List<VolumeVO> volumes = _volsDao.findByAccount(accountId);
|
||||
List<VolumeVO> volumes = _volsDao.findIncludingRemovedByAccount(accountId);
|
||||
// The above call will list only non-destroyed volumes.
|
||||
// So call this method before marking the volumes as destroyed.
|
||||
// i.e Call them before the VMs for those volumes are destroyed.
|
||||
|
|
|
|||
Loading…
Reference in New Issue