Arik Hadas has uploaded a new change for review.

Change subject: core: snapshot's memory volume type by storage type
......................................................................

core: snapshot's memory volume type by storage type

The volume for the memory dump that is saved as part of live snapshot
with memory was created as 'preallocated' volume, in order to be
suitable for all storage type as 'preallocated' and 'raw' volumes are
supported by all storage types.

This patch changes it, the type of the memory dump volume is determined
according to storage type, exactly the way it is done for hibernation's
memory volume: in file-based storage it is created as 'sparse' and in
block based storage as 'preallocated' (always as 'raw'), as it seems to
be much faster to create sparsed volume on file-based storage.

A proper conversions will need to be done at export & import operations
according to the storage type.

Change-Id: I1c0031c4257576d16162ef09bb5086b5ee784132
Bug-Url: https://bugzilla.redhat.com/960931
Signed-off-by: Arik Hadas <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/LiveSnapshotMemoryImageBuilder.java
2 files changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/29/16529/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
index 817ab4c..096bd0c 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
@@ -12,6 +12,7 @@
 import org.ovirt.engine.core.common.asynctasks.EntityInfo;
 import org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType;
 import org.ovirt.engine.core.common.businessentities.StorageDomain;
+import org.ovirt.engine.core.common.businessentities.StorageType;
 import org.ovirt.engine.core.common.businessentities.VMStatus;
 import org.ovirt.engine.core.common.businessentities.VolumeFormat;
 import org.ovirt.engine.core.common.businessentities.VolumeType;
@@ -131,7 +132,7 @@
                                             getStorageDomainId(),
                                             image1GroupId,
                                             
getVm().getTotalMemorySizeInBytes(),
-                                            getVolumeType(),
+                                            getMemoryVolumeType(),
                                             VolumeFormat.RAW,
                                             hiberVol1,
                                             "",
@@ -367,15 +368,18 @@
         }
     }
 
+    private VolumeType getMemoryVolumeType() {
+        return 
getMemoryVolumeTypeForPool(getStoragePool().getstorage_pool_type());
+    }
+
     /**
      * Returns whether to use Sparse or Preallocation. If the storage type is 
file system devices ,it would be more
      * efficient to use Sparse allocation. Otherwise for block devices we 
should use Preallocated for faster allocation.
      *
      * @return - VolumeType of allocation type to use.
      */
-    private VolumeType getVolumeType() {
-        return (getStoragePool().getstorage_pool_type().isFileDomain()) ? 
VolumeType.Sparse
-                : VolumeType.Preallocated;
+    public static VolumeType getMemoryVolumeTypeForPool(StorageType 
storageType) {
+        return storageType.isFileDomain() ? VolumeType.Sparse : 
VolumeType.Preallocated;
     }
 
     private static Log log = LogFactory.getLog(HibernateVmCommand.class);
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/LiveSnapshotMemoryImageBuilder.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/LiveSnapshotMemoryImageBuilder.java
index 5aedb53..bc0a726 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/LiveSnapshotMemoryImageBuilder.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/LiveSnapshotMemoryImageBuilder.java
@@ -91,7 +91,7 @@
                                 storageDomainId,
                                 memoryDumpImageGroupId,
                                 vm.getTotalMemorySizeInBytes(),
-                                VolumeType.Preallocated,
+                                
HibernateVmCommand.getMemoryVolumeTypeForPool(storagePool.getstorage_pool_type()),
                                 VolumeFormat.RAW,
                                 memoryDumpVolumeId,
                                 "",


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

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

Reply via email to