@@ -383,7 +383,7 @@ public ImageFormat getImageFormat(Long volumeId) {
383383
384384 public VolumeDaoImpl () {
385385 AllFieldsSearch = createSearchBuilder ();
386- AllFieldsSearch .and ("state" , AllFieldsSearch .entity ().getState (), Op .EQ );
386+ AllFieldsSearch .and ("state" , AllFieldsSearch .entity ().getState (), Op .IN );
387387 AllFieldsSearch .and ("accountId" , AllFieldsSearch .entity ().getAccountId (), Op .EQ );
388388 AllFieldsSearch .and ("dcId" , AllFieldsSearch .entity ().getDataCenterId (), Op .EQ );
389389 AllFieldsSearch .and ("pod" , AllFieldsSearch .entity ().getPodId (), Op .EQ );
@@ -581,17 +581,16 @@ public long secondaryStorageUsedForAccount(long accountId) {
581581
582582 @ Override
583583 public List <VolumeVO > listVolumesToBeDestroyed () {
584- SearchCriteria <VolumeVO > sc = AllFieldsSearch .create ();
585- sc .setParameters ("state" , Volume .State .Destroy );
586-
587- return listBy (sc );
584+ return listVolumesToBeDestroyed (null );
588585 }
589586
590587 @ Override
591588 public List <VolumeVO > listVolumesToBeDestroyed (Date date ) {
592589 SearchCriteria <VolumeVO > sc = AllFieldsSearch .create ();
593- sc .setParameters ("state" , Volume .State .Destroy );
594- sc .setParameters ("updateTime" , date );
590+ sc .setParameters ("state" , Volume .State .Destroy , Volume .State .Expunging );
591+ if (date != null ) {
592+ sc .setParameters ("updateTime" , date );
593+ }
595594
596595 return listBy (sc );
597596 }
0 commit comments