1616// under the License.
1717package com .cloud .storage .dao ;
1818
19- import java .sql .Connection ;
2019import java .sql .PreparedStatement ;
2120import java .sql .ResultSet ;
2221import java .sql .SQLException ;
2322import java .util .ArrayList ;
2423import java .util .Collections ;
2524import java .util .Date ;
26- import java .util .HashSet ;
2725import java .util .List ;
28- import java .util .Set ;
26+ import java .util .stream . Collectors ;
2927
3028import javax .inject .Inject ;
3129
@@ -73,7 +71,6 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
7371 protected final SearchBuilder <VolumeVO > RootDiskStateSearch ;
7472 private final SearchBuilder <VolumeVO > storeAndInstallPathSearch ;
7573 private final SearchBuilder <VolumeVO > volumeIdSearch ;
76- private final SearchBuilder <VolumeVO > encryptedIdSearch ;
7774 protected GenericSearchBuilder <VolumeVO , Long > CountByAccount ;
7875 protected GenericSearchBuilder <VolumeVO , SumCount > primaryStorageSearch ;
7976 protected GenericSearchBuilder <VolumeVO , SumCount > primaryStorageSearch2 ;
@@ -84,7 +81,6 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
8481 @ Inject
8582 ResourceTagDao _tagsDao ;
8683
87- protected static final String SELECT_VM_SQL = "SELECT DISTINCT instance_id from volumes v where v.host_id = ? and v.mirror_state = ?" ;
8884 // need to account for zone-wide primary storage where storage_pool has
8985 // null-value pod and cluster, where hypervisor information is stored in
9086 // storage_pool
@@ -501,10 +497,6 @@ public VolumeDaoImpl() {
501497 volumeIdSearch .and ("idIN" , volumeIdSearch .entity ().getId (), Op .IN );
502498 volumeIdSearch .done ();
503499
504- encryptedIdSearch = createSearchBuilder ();
505- encryptedIdSearch .and ("encryptionMethod" , encryptedIdSearch .entity ().getId (), Op .NNULL );
506- encryptedIdSearch .done ();
507-
508500 poolAndPathSearch = createSearchBuilder ();
509501 poolAndPathSearch .and ("poolId" , poolAndPathSearch .entity ().getPoolId (), Op .EQ );
510502 poolAndPathSearch .and ("path" , poolAndPathSearch .entity ().getPath (), Op .EQ );
@@ -870,23 +862,6 @@ public List<VolumeVO> listByIds(List<Long> ids) {
870862 return listBy (sc , null );
871863 }
872864
873- @ Override
874- public Set <Long > listEncryptedVolumeIds () {
875- String selectSql = "SELECT id FROM volumes WHERE encrypt_format IS NOT NULL" ;
876- Set <Long > ids = new HashSet <>();
877- Connection conn = TransactionLegacy .getStandaloneConnection ();
878- try {
879- PreparedStatement stmt = conn .prepareStatement (selectSql );
880- ResultSet rs = stmt .executeQuery ();
881- while (rs != null && rs .next ()) {
882- ids .add (rs .getLong (1 ));
883- }
884- } catch (SQLException ex ) {
885- throw new CloudRuntimeException ("Error while trying to find ids for encrypted volumes" , ex );
886- }
887- return ids ;
888- }
889-
890865 @ Override
891866 public List <VolumeVO > listAllocatedVolumesForAccountDiskOfferingIdsAndNotForVms (long accountId , List <Long > diskOfferingIds , List <Long > vmIds ) {
892867 SearchBuilder <VolumeVO > sb = createSearchBuilder ();
0 commit comments