Vered Volansky has uploaded a new change for review.

Change subject: core: Removed redundant storage allocation for stateless VM
......................................................................

core: Removed redundant storage allocation for stateless VM

When running a stateless VM, storage allocation checks were run only on plugged
disks in RunVmCommand. The Commands run CreateAllSnapshotsFromVm
internally, which also calls the storage allocation checks, this time on
all disks.
This patch removed the RunVmCommand storage allocation check and propagates the
error message from the internal command, so that an appropriate error
message is displayed in the UI.

Change-Id: I29deabd07d23c5b560b8fca51a9831d026d04ab8
Bug-Url: https://bugzilla.redhat.com/1181133
Signed-off-by: Vered Volansky <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
2 files changed, 1 insertion(+), 28 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/46/37446/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
index 6a63925..62d2bd9 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
@@ -405,15 +405,14 @@
             setSucceeded(vdcReturnValue.getSucceeded());
 
             if (vdcReturnValue.getSucceeded()) {
-
                 
getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList());
             } else {
                 if (areDisksLocked(vdcReturnValue)) {
                     throw new 
VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL);
                 }
-                getReturnValue().setFault(vdcReturnValue.getFault());
                 log.error("Failed to create stateless snapshot for VM '{}' 
({})",
                         getVm().getName(), getVm().getId());
+                propagateFailure(vdcReturnValue);
             }
         }
     }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
index 9d5dc52..13756b6 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
@@ -1,7 +1,6 @@
 package org.ovirt.engine.core.bll.validator;
 
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -343,11 +342,6 @@
             return new 
ValidationResult(VdcBllMessages.VM_CANNOT_RUN_STATELESS_HA);
         }
 
-        ValidationResult hasSpaceValidation = hasSpaceForSnapshots();
-        if (!hasSpaceValidation.isValid()) {
-            return hasSpaceValidation;
-        }
-
         return ValidationResult.VALID;
     }
 
@@ -358,26 +352,6 @@
         }
 
         return ValidationResult.VALID;
-    }
-
-    /**
-     * check that we can create snapshots for all disks
-     * return true if all storage domains have enough space to create 
snapshots for this VM plugged disks
-     */
-    protected ValidationResult hasSpaceForSnapshots() {
-        Set<Guid> sdIds = 
ImagesHandler.getAllStorageIdsForImageIds(getVmImageDisks());
-
-        MultipleStorageDomainsValidator msdValidator = 
getStorageDomainsValidator(sdIds);
-        ValidationResult retVal = msdValidator.allDomainsWithinThresholds();
-        if (retVal == ValidationResult.VALID) {
-            return 
msdValidator.allDomainsHaveSpaceForNewDisks(getVmImageDisks());
-        }
-        return retVal;
-    }
-
-    protected MultipleStorageDomainsValidator 
getStorageDomainsValidator(Collection<Guid> sdIds) {
-        Guid spId = vm.getStoragePoolId();
-        return new MultipleStorageDomainsValidator(spId, sdIds);
     }
 
     protected ValidationResult validateStoragePoolUp(VM vm, StoragePool 
storagePool, List<DiskImage> vmImages) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I29deabd07d23c5b560b8fca51a9831d026d04ab8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vered Volansky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to