Allon Mureinik has uploaded a new change for review.

Change subject: core: Remove unused GetDisksForQuotaIdQuery
......................................................................

core: Remove unused GetDisksForQuotaIdQuery

GetDisksForQuotaIdQuery is not used anywhere in the code, and hence
should be removed.

This patch removes the following:
1. The GetDisksForQuotaIdQuery class
2. The GetDisksForQuotaId constant representing it in VdcQueryType
3. The getAllForQuotaId(Guid) method in DiskImageDAO (which was only
   used by the query), its implementation, and its test.
4. The GetImagesByQuotaId(UUID) stored procedure that was only used by
   the said DAO function.

Change-Id: I77f8c0a54fbcdc150234888d73a941088376ef3e
Signed-off-by: Allon Mureinik <amure...@redhat.com>
---
M backend/manager/dbscripts/disk_images_sp.sql
D 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetDisksForQuotaIdQuery.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAO.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAODbFacadeImpl.java
M 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DiskImageDAOTest.java
6 files changed, 0 insertions(+), 57 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/08/13108/1

diff --git a/backend/manager/dbscripts/disk_images_sp.sql 
b/backend/manager/dbscripts/disk_images_sp.sql
index c75bac8..3266cd7 100644
--- a/backend/manager/dbscripts/disk_images_sp.sql
+++ b/backend/manager/dbscripts/disk_images_sp.sql
@@ -101,17 +101,6 @@
 
 
 
-Create or replace FUNCTION GetImagesByQuotaId(v_quota_id UUID)
-RETURNS SETOF images_storage_domain_view
-   AS $procedure$
-BEGIN
-      RETURN QUERY SELECT *
-      FROM images_storage_domain_view
-      WHERE quota_id = v_quota_id;
-
-END; $procedure$
-LANGUAGE plpgsql;
-
 Create or replace FUNCTION GetSnapshotsByVmSnapshotId(v_vm_snapshot_id UUID)
 RETURNS SETOF images_storage_domain_view
    AS $procedure$
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetDisksForQuotaIdQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetDisksForQuotaIdQuery.java
deleted file mode 100644
index 6c6f729..0000000
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetDisksForQuotaIdQuery.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.ovirt.engine.core.bll;
-
-import java.util.List;
-
-import org.ovirt.engine.core.common.businessentities.DiskImage;
-import org.ovirt.engine.core.common.queries.GetDisksByQuotaIdParameters;
-
-public class GetDisksForQuotaIdQuery<P extends GetDisksByQuotaIdParameters> 
extends QueriesCommandBase<P> {
-    public GetDisksForQuotaIdQuery(P parameters) {
-        super(parameters);
-    }
-
-    @Override
-    protected void executeQueryCommand() {
-        List<DiskImage> disks = 
getDbFacade().getDiskImageDao().getAllForQuotaId(getParameters().getQuotaId());
-        for (DiskImage diskImage : disks) {
-            diskImage.getSnapshots().addAll(
-                    ImagesHandler.getAllImageSnapshots(diskImage.getImageId(), 
diskImage.getImageTemplateId()));
-        }
-        getQueryReturnValue().setReturnValue(disks);
-    }
-}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
index 1a8f1d1..0530375 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
@@ -256,7 +256,6 @@
     GetQuotaByQuotaId,
     GetQuotaVdsGroupByQuotaId,
     GetQuotaStorageByQuotaId,
-    GetDisksForQuotaId,
     GetVmsRelatedToQuotaId,
     GetTemplatesRelatedToQuotaId,
     GetPermissionsToConsumeQuotaByQuotaId,
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAO.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAO.java
index 32db613..3fc82ea 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAO.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAO.java
@@ -74,6 +74,4 @@
      * @return List of images (empty if none found).
      */
     List<DiskImage> getImagesWithNoDisk(Guid vmId);
-
-    List<DiskImage> getAllForQuotaId(Guid quotaId);
 }
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAODbFacadeImpl.java
index 3cab4f8..dabe39e 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAODbFacadeImpl.java
@@ -42,14 +42,6 @@
     }
 
     @Override
-    public List<DiskImage> getAllForQuotaId(Guid quotaId) {
-        MapSqlParameterSource parameterSource = 
getCustomMapSqlParameterSource()
-                .addValue("quota_id", quotaId);
-
-        return getCallsHandler().executeReadList("GetImagesByQuotaId", 
DiskImageRowMapper.instance, parameterSource);
-    }
-
-    @Override
     public List<DiskImage> getAllSnapshotsForParent(Guid id) {
         MapSqlParameterSource parameterSource = 
getCustomMapSqlParameterSource()
                 .addValue("parent_guid", id);
diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DiskImageDAOTest.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DiskImageDAOTest.java
index 099f97a..015e08a 100644
--- 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DiskImageDAOTest.java
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DiskImageDAOTest.java
@@ -12,7 +12,6 @@
 import org.apache.commons.lang.NotImplementedException;
 import org.junit.Test;
 import org.ovirt.engine.core.common.businessentities.DiskImage;
-import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum;
 import org.ovirt.engine.core.compat.Guid;
 
 /**
@@ -83,18 +82,6 @@
 
         assertNotNull(result);
         assertEquals(ANCESTOR_IMAGE_ID, result.getImageId());
-    }
-
-    @Test
-    public void testGetAllForQuotaId() {
-        List<DiskImage> disks = 
dao.getAllForQuotaId(FixturesTool.QUOTA_GENERAL);
-        assertEquals("VM should have five disks", 5, disks.size());
-        for (DiskImage disk : disks) {
-            assertEquals("Wrong quota enforcement type",
-                    QuotaEnforcementTypeEnum.DISABLED,
-                    disk.getQuotaEnforcementType());
-            assertFalse("Qutoa should not be default", disk.isQuotaDefault());
-        }
     }
 
     @Test


--
To view, visit http://gerrit.ovirt.org/13108
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I77f8c0a54fbcdc150234888d73a941088376ef3e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amure...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to