Tal Nisan has uploaded a new change for review.

Change subject: core: Predetermine volume type on copy according to the 
destination domain
......................................................................

core: Predetermine volume type on copy according to the destination domain

Signed-off-by: Tal Nisan <tni...@redhat.com>
https://bugzilla.redhat.com/1084789
Change-Id: I75f58d73e95a73bf7d74f318dbd95cd838a74e98
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CopyImageGroupCommand.java
1 file changed, 17 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/25/27525/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CopyImageGroupCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CopyImageGroupCommand.java
index 899b962..d5805b3 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CopyImageGroupCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CopyImageGroupCommand.java
@@ -14,6 +14,8 @@
 import org.ovirt.engine.core.common.businessentities.DiskImage;
 import org.ovirt.engine.core.common.businessentities.ImageOperation;
 import org.ovirt.engine.core.common.businessentities.ImageStorageDomainMapId;
+import org.ovirt.engine.core.common.businessentities.StorageDomainStatic;
+import org.ovirt.engine.core.common.businessentities.VolumeType;
 import org.ovirt.engine.core.common.businessentities.image_storage_domain_map;
 import org.ovirt.engine.core.common.vdscommands.CopyImageVDSCommandParameters;
 import 
org.ovirt.engine.core.common.vdscommands.MoveImageGroupVDSCommandParameters;
@@ -74,8 +76,7 @@
                             getParameters()
                                     .getCopyVolumeType(),
                             getParameters().getVolumeFormat(),
-                            getParameters()
-                                    .getVolumeType(),
+                            
getVolumeTypeForDomain(getParameters().getStorageDomainId()),
                             isWipeAfterDelete(),
                             getParameters()
                                     .getForceOverride()));
@@ -122,6 +123,20 @@
     }
 
     /**
+     * Since we are supporting copy/move operations between different storage 
families (file/block) we have to
+     * predetermine the volume type according to the destination storage type, 
for block domains we cannot use sparse
+     * for file domains we will use the same type of the original image
+     * @param storageDomainId
+     * @return
+     */
+    private VolumeType getVolumeTypeForDomain(Guid storageDomainId) {
+        StorageDomainStatic destDomain = 
getStorageDomainStaticDAO().get(storageDomainId);
+        VolumeType volumeType= destDomain.getStorageType().isBlockDomain() ? 
VolumeType.Preallocated :
+                getParameters().getVolumeType();
+        return volumeType;
+    }
+
+    /**
      * Shareable disk which shared between more then one VM, will be returned 
more then once when fetching the images by image group
      * since it has multiple VM devices (one for each VM it is attached to) 
and not because he has snapshots,
      * so the shareable disk needs to be distinct when updating the storage 
domain.


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

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

Reply via email to