Maor Lipchuk has uploaded a new change for review.

Change subject:  core: Use storage validator on Live Migrate disk.
......................................................................

core: Use storage validator on Live Migrate disk.

Use storage validator instead regular check when validating space
requirements in the CDA phase.

Change-Id: I116f12c0d4c05bd03f0f42009b4727fbd6b71420
Signed-off-by: Maor Lipchuk <mlipc...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommand.java
1 file changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/11587/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommand.java
index 4c98d1b..6d70b64 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommand.java
@@ -12,7 +12,6 @@
 import org.ovirt.engine.core.bll.InternalCommandAttribute;
 import org.ovirt.engine.core.bll.LockIdNameAttribute;
 import org.ovirt.engine.core.bll.NonTransactiveCommandAttribute;
-import org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceChecker;
 import org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter;
 import org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter;
 import org.ovirt.engine.core.bll.quota.QuotaStorageDependent;
@@ -290,9 +289,8 @@
             Guid storagePoolId = 
disksList.get(0).getstorage_pool_id().getValue();
             storage_domains destDomain = getStorageDomainById(destDomainId, 
storagePoolId);
 
-            if (!StorageDomainSpaceChecker.isWithinThresholds(destDomain)) {
-                addCanDoActionMessage(String.format("$%1$s %2$s", 
"storageName", destDomain.getstorage_name()));
-                return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN);
+            if (!isStorageDomainWithinThresholds(destDomain)) {
+                return false;
             }
 
             long totalImagesSize = 0;
@@ -305,12 +303,19 @@
                 totalImagesSize += 
Math.round(diskImage.getActualDiskWithSnapshotsSize());
             }
 
-            if (!StorageDomainSpaceChecker.hasSpaceForRequest(destDomain, 
totalImagesSize)) {
-                return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW);
+            if (!doesStorageDomainhaveSpaceForRequest(destDomain, 
totalImagesSize)) {
+                return false;
             }
         }
 
         return true;
     }
 
+    protected boolean isStorageDomainWithinThresholds(storage_domains 
storageDomain) {
+        return validate(new 
StorageDomainValidator(storageDomain).isDomainWithinThresholds());
+    }
+
+    protected boolean doesStorageDomainhaveSpaceForRequest(storage_domains 
storageDomain, long totalImagesSize) {
+        return validate(new 
StorageDomainValidator(storageDomain).isDomainHasSpaceForRequest(totalImagesSize));
+    }
 }


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

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

Reply via email to