mirror of https://github.com/apache/cloudstack.git
Add volumes in 'Expunging' state to storage cleanup thread and during delete storage pool (#12602)
This commit is contained in:
parent
8b38cea33c
commit
32c0cdbed9
|
|
@ -382,7 +382,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
|
||||
public VolumeDaoImpl() {
|
||||
AllFieldsSearch = createSearchBuilder();
|
||||
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
|
||||
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.IN);
|
||||
AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), Op.EQ);
|
||||
AllFieldsSearch.and("dcId", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);
|
||||
AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodId(), Op.EQ);
|
||||
|
|
@ -579,17 +579,16 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
|
||||
@Override
|
||||
public List<VolumeVO> listVolumesToBeDestroyed() {
|
||||
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("state", Volume.State.Destroy);
|
||||
|
||||
return listBy(sc);
|
||||
return listVolumesToBeDestroyed(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> listVolumesToBeDestroyed(Date date) {
|
||||
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("state", Volume.State.Destroy);
|
||||
sc.setParameters("updateTime", date);
|
||||
sc.setParameters("state", Volume.State.Destroy, Volume.State.Expunging);
|
||||
if (date != null) {
|
||||
sc.setParameters("updateTime", date);
|
||||
}
|
||||
|
||||
return listBy(sc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -434,6 +434,9 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
// no need to change state in volumes table
|
||||
volume.processEventOnly(Event.DestroyRequested);
|
||||
} else if (volume.getDataStore().getRole() == DataStoreRole.Primary) {
|
||||
if (vol.getState() == Volume.State.Expunging) {
|
||||
logger.info("Volume {} is already in Expunging, retrying", volume);
|
||||
}
|
||||
volume.processEvent(Event.ExpungeRequested);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue