@@ -382,7 +382,7 @@ public ImageFormat getImageFormat(Long volumeId) {
382382
383383 public VolumeDaoImpl () {
384384 AllFieldsSearch = createSearchBuilder ();
385- AllFieldsSearch .and ("state" , AllFieldsSearch .entity ().getState (), Op .EQ );
385+ AllFieldsSearch .and ("state" , AllFieldsSearch .entity ().getState (), Op .IN );
386386 AllFieldsSearch .and ("accountId" , AllFieldsSearch .entity ().getAccountId (), Op .EQ );
387387 AllFieldsSearch .and ("dcId" , AllFieldsSearch .entity ().getDataCenterId (), Op .EQ );
388388 AllFieldsSearch .and ("pod" , AllFieldsSearch .entity ().getPodId (), Op .EQ );
@@ -579,17 +579,16 @@ public long secondaryStorageUsedForAccount(long accountId) {
579579
580580 @ Override
581581 public List <VolumeVO > listVolumesToBeDestroyed () {
582- SearchCriteria <VolumeVO > sc = AllFieldsSearch .create ();
583- sc .setParameters ("state" , Volume .State .Destroy );
584-
585- return listBy (sc );
582+ return listVolumesToBeDestroyed (null );
586583 }
587584
588585 @ Override
589586 public List <VolumeVO > listVolumesToBeDestroyed (Date date ) {
590587 SearchCriteria <VolumeVO > sc = AllFieldsSearch .create ();
591- sc .setParameters ("state" , Volume .State .Destroy );
592- sc .setParameters ("updateTime" , date );
588+ sc .setParameters ("state" , Volume .State .Destroy , Volume .State .Expunging );
589+ if (date != null ) {
590+ sc .setParameters ("updateTime" , date );
591+ }
593592
594593 return listBy (sc );
595594 }
0 commit comments