Vered Volansky has uploaded a new change for review.

Change subject: core: Add VM - Storage allocation validation fix
......................................................................

core: Add VM - Storage allocation validation fix

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: I13f8585a04157a55528ad4331455c3f156bdb84b
Bug-Url: https://bugzilla.redhat.com/
Signed-off-by: Vered Volansky <vvola...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/17/36617/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
index 98705e1..d47be77 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
@@ -68,6 +68,8 @@
 import org.ovirt.engine.core.common.businessentities.VmTemplate;
 import org.ovirt.engine.core.common.businessentities.VmType;
 import org.ovirt.engine.core.common.businessentities.VmWatchdog;
+import org.ovirt.engine.core.common.businessentities.VolumeFormat;
+import org.ovirt.engine.core.common.businessentities.VolumeType;
 import org.ovirt.engine.core.common.businessentities.network.Network;
 import org.ovirt.engine.core.common.businessentities.network.VmInterfaceType;
 import org.ovirt.engine.core.common.businessentities.network.VmNic;
@@ -381,8 +383,15 @@
         return validate(storageDomainValidator.isDomainWithinThresholds());
     }
 
+    //This validation is for thin provisioning, when done differently on other 
commands, this method should be overridden.
     protected boolean validateFreeSpace(StorageDomainValidator 
storageDomainValidator, List<DiskImage> disksList)
     {
+        // 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.
+        for (DiskImage disk : disksList) {
+            disk.setVolumeType(VolumeType.Sparse);
+            disk.setvolumeFormat(VolumeFormat.COW);
+        }
         return validate(storageDomainValidator.hasSpaceForNewDisks(disksList));
     }
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I13f8585a04157a55528ad4331455c3f156bdb84b
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