Vered Volansky has uploaded a new change for review.

Change subject: core: Adding a pool with vm storage allocation
......................................................................

core: Adding a pool with vm storage allocation

In the current situation, allocation checks are done on the template
disk, which may be of the wrong storage type/format. Updating the
image's data to support the allocation validations.

Change-Id: Ia46bef12bbc0462bb42956f95bdff1855631e7b6
Bug-Url: https://bugzilla.redhat.com/1178021
Signed-off-by: Vered Volansky <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmPoolWithVmsCommand.java
1 file changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/85/36585/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmPoolWithVmsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmPoolWithVmsCommand.java
index a051ef8..60c6db0 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmPoolWithVmsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmPoolWithVmsCommand.java
@@ -19,6 +19,8 @@
 import org.ovirt.engine.core.common.businessentities.ActionGroup;
 import org.ovirt.engine.core.common.businessentities.DiskImage;
 import org.ovirt.engine.core.common.businessentities.VmPool;
+import org.ovirt.engine.core.common.businessentities.VolumeFormat;
+import org.ovirt.engine.core.common.businessentities.VolumeType;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.common.validation.group.CreateEntity;
 import org.ovirt.engine.core.compat.Guid;
@@ -131,11 +133,13 @@
 
     protected boolean validateSpaceRequirements() {
         int numOfVms = getParameters().getVmsCount();
+        List<DiskImage> diskdummies = getDiskList();
         List<DiskImage> disksList = new ArrayList<>();
         // Number of added disks multiplies by the vms number
         for (int i = 0; i < numOfVms; ++i) {
             disksList.addAll(diskInfoDestinationMap.values());
         }
+
         Guid spId = getVmTemplate().getStoragePoolId();
         Set<Guid> sdIds = destStorages.keySet();
         MultipleStorageDomainsValidator storageDomainsValidator = 
getStorageDomainsValidator(spId, sdIds);
@@ -146,4 +150,17 @@
     protected MultipleStorageDomainsValidator getStorageDomainsValidator(Guid 
spId, Set<Guid> sdIds) {
         return new MultipleStorageDomainsValidator(spId, sdIds);
     }
+
+    private List<DiskImage> getDiskList() {
+        List<DiskImage> disksList = new ArrayList<>();
+        for (DiskImage diskImage : diskInfoDestinationMap.values()) {
+            DiskImage clone = DiskImage.copyOf(diskImage);
+            // At this point the disks are the template's, which could have 
another volume type/format
+            // This change is for storage allocation validations, "real" 
override for these values is done in CreateSnapshotCommand.
+            clone.setVolumeType(VolumeType.Sparse);
+            clone.setvolumeFormat(VolumeFormat.COW);
+            disksList.add(clone);
+        }
+        return disksList;
+    }
 }


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

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

Reply via email to