Vered Volansky has uploaded a new change for review.

Change subject: core: Remove redundant threshold call
......................................................................

core: Remove redundant threshold call

While adding storage domains to a map in
ImagesHandler.fillImagesMapBasedOnTemplate(), there's a threshold check.
This check is redundant and buggy here.
Redundant because there are storage allocation checks in the system
now, which should be called in due time.

Buggy, since in case the threshold has been met, the threshold
validation fails, but with no error at the time of failure.
The map is not filled correctly, and we get another, unrelated error.

This patch removes the threshold validation and relies on it being
called when it should.

Change-Id: Ifb4357a19bc51ae5feb3c8e79ff36f3adacc327f
Bug-Url: https://bugzilla.redhat.com/tbd
Related-To: https://bugzilla.redhat.com/1179690
Signed-off-by: Vered Volansky <vvola...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java
3 files changed, 6 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/37213/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java
index db7666e..f4a00c3 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java
@@ -350,7 +350,7 @@
             } else {
                 ImagesHandler.fillImagesMapBasedOnTemplate(getVmTemplate(),
                         diskInfoDestinationMap,
-                        destStorages, false);
+                        destStorages);
             }
         }
         if (getVmTemplate().getDiskTemplateMap().values().size() != 
diskInfoDestinationMap.size()) {
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
index 6bb5899..2fd10ee 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
@@ -76,27 +76,25 @@
      * @param template
      * @param diskInfoDestinationMap
      * @param destStorages
-     * @param notCheckSize - if we need to perform a size check for storage or 
not
      */
     public static void fillImagesMapBasedOnTemplate(VmTemplate template,
             Map<Guid, DiskImage> diskInfoDestinationMap,
-            Map<Guid, StorageDomain> destStorages, boolean notCheckSize) {
+            Map<Guid, StorageDomain> destStorages) {
         List<StorageDomain> domains =
                 DbFacade.getInstance()
                         .getStorageDomainDao()
                         .getAllForStoragePool(template.getStoragePoolId());
-        fillImagesMapBasedOnTemplate(template, domains, 
diskInfoDestinationMap, destStorages, notCheckSize);
+        fillImagesMapBasedOnTemplate(template, domains, 
diskInfoDestinationMap, destStorages);
     }
 
     public static void fillImagesMapBasedOnTemplate(VmTemplate template,
             List<StorageDomain> domains,
             Map<Guid, DiskImage> diskInfoDestinationMap,
-            Map<Guid, StorageDomain> destStorages, boolean notCheckSize) {
+            Map<Guid, StorageDomain> destStorages) {
         Map<Guid, StorageDomain> storageDomainsMap = new HashMap<Guid, 
StorageDomain>();
         for (StorageDomain storageDomain : domains) {
             StorageDomainValidator validator = new 
StorageDomainValidator(storageDomain);
-            if (validator.isDomainExistAndActive().isValid() && 
validator.domainIsValidDestination().isValid()
-                    && (notCheckSize || 
validator.isDomainWithinThresholds().isValid())) {
+            if (validator.isDomainExistAndActive().isValid() && 
validator.domainIsValidDestination().isValid()) {
                 storageDomainsMap.put(storageDomain.getId(), storageDomain);
             }
         }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java
index 686a63e..eedd485 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java
@@ -120,7 +120,7 @@
             // check that images are ok
             ImagesHandler.fillImagesMapBasedOnTemplate(getVmTemplate(),
                     imageFromSourceDomainMap,
-                    null, true);
+                    null);
             if (getVmTemplate().getDiskTemplateMap().values().size() != 
imageFromSourceDomainMap.size()) {
                 log.error("Can not found any default active domain for one of 
the disks of template with id '{}'",
                         getVmTemplate().getId());


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

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

Reply via email to