Merge pull request #2098 from mike-tutkowski/CLOUDSTACK-9917

Fix for CLOUDSTACK-9660
This commit is contained in:
Rajani Karuturi 2017-05-24 15:41:58 +05:30 committed by GitHub
commit 0b98923679
3 changed files with 3 additions and 6 deletions

View File

@ -80,7 +80,7 @@ public interface VolumeDao extends GenericDao<VolumeVO, Long>, StateDao<Volume.S
List<VolumeVO> listVolumesToBeDestroyed();
List<VolumeVO> listNonRootVolumesToBeDestroyed(Date date);
List<VolumeVO> listVolumesToBeDestroyed(Date date);
ImageFormat getImageFormat(Long volumeId);

View File

@ -325,7 +325,6 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
AllFieldsSearch.and("deviceId", AllFieldsSearch.entity().getDeviceId(), Op.EQ);
AllFieldsSearch.and("poolId", AllFieldsSearch.entity().getPoolId(), Op.EQ);
AllFieldsSearch.and("vType", AllFieldsSearch.entity().getVolumeType(), Op.EQ);
AllFieldsSearch.and("notVolumeType", AllFieldsSearch.entity().getVolumeType(), Op.NEQ);
AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
AllFieldsSearch.and("destroyed", AllFieldsSearch.entity().getState(), Op.EQ);
AllFieldsSearch.and("notDestroyed", AllFieldsSearch.entity().getState(), Op.NEQ);
@ -482,10 +481,9 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
}
@Override
public List<VolumeVO> listNonRootVolumesToBeDestroyed(Date date) {
public List<VolumeVO> listVolumesToBeDestroyed(Date date) {
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
sc.setParameters("state", Volume.State.Destroy);
sc.setParameters("notVolumeType", Volume.Type.ROOT.toString());
sc.setParameters("updateTime", date);
return listBy(sc);

View File

@ -1080,8 +1080,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
cleanupSecondaryStorage(recurring);
// ROOT volumes will be destroyed as part of VM cleanup
List<VolumeVO> vols = _volsDao.listNonRootVolumesToBeDestroyed(new Date(System.currentTimeMillis() - ((long) StorageCleanupDelay.value() << 10)));
List<VolumeVO> vols = _volsDao.listVolumesToBeDestroyed(new Date(System.currentTimeMillis() - ((long) StorageCleanupDelay.value() << 10)));
for (VolumeVO vol : vols) {
try {
// If this fails, just log a warning. It's ideal if we clean up the host-side clustered file