Federico Simoncelli has uploaded a new change for review.

Change subject: image: placeholder optimization on preallocation
......................................................................

image: placeholder optimization on preallocation

When the destination of a copy or move command is an NFS domain
we should try to optimize the placeholders creation avoiding
unnecessary prezeroing (only relevant case: RAW PREALLOCATED).
In such case in the past we were using a TEMPORARY_VOLUME_SIZE
to create a placeholder with a temporary size of 10Mb.
This is interfering with live storage migration as the following
volumes in the chain are inheriting the temporary size inside the
qcow header (virtual disk size).
With this patch we are instead forcing the creation of the volume
as SPARSE as this won't have any side effect on the qcow header.

Change-Id: I32811bd45320ef02bfc593a71dfdafc0b0550c7d
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=910445
Signed-off-by: Federico Simoncelli <[email protected]>
---
M vdsm/storage/blockSD.py
M vdsm/storage/image.py
M vdsm/storage/sd.py
3 files changed, 30 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/12692/1

diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 9809bf4..e040596 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -431,6 +431,14 @@
     def requiresMailbox(self):
         return True
 
+    @property
+    def lightweightPreallocation(self):
+        """
+        This property advertises whether creating preallocated volumes
+        is a lightweight operation or not.
+        """
+        return True
+
     def _registerResourceNamespaces(self):
         """
         Register resources namespaces and create
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 92021ff..1b6f89d 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -523,18 +523,20 @@
                     # find out src volume parameters
                     volParams = srcVol.getVolumeParams(bs=1)
 
-                    # To avoid 'prezeroing' preallocated volume on NFS domain,
-                    # we create the target volume with minimal size and after
-                    # that w'll change its metadata back to the original size.
-                    if (volParams['volFormat'] == volume.COW_FORMAT
-                            or volParams['prealloc'] == volume.SPARSE_VOL):
-                        volTmpSize = volParams['size']
+                    # To avoid prezeroing preallocated volumes on NFS domains
+                    # we create the target as a sparse volume (since it will be
+                    # soon filled with the data coming from the copy) and then
+                    # we change its metadata back to the original value.
+                    if (volParams['prealloc'] == volume.PREALLOCATED_VOL
+                            and not destDom.lightweightPreallocation):
+                        tmpVolPreallocation = volume.SPARSE_VOL
                     else:
-                        volTmpSize = TEMPORARY_VOLUME_SIZE  # in sectors (10M)
+                        tmpVolPreallocation = volParams['prealloc']
 
-                    destDom.createVolume(imgUUID=imgUUID, size=volTmpSize,
+                    destDom.createVolume(imgUUID=imgUUID,
+                                         size=volParams['size'],
                                          volFormat=volParams['volFormat'],
-                                         preallocate=volParams['prealloc'],
+                                         preallocate=tmpVolPreallocation,
                                          diskType=volParams['disktype'],
                                          volUUID=srcVol.volUUID,
                                          desc=volParams['descr'],
@@ -548,9 +550,9 @@
                     dstVol.extend((volParams['apparentsize'] + 511) / 512)
 
                     # Change destination volume metadata back to the original
-                    # size.
-                    if volTmpSize != volParams['size']:
-                        dstVol.setSize(volParams['size'])
+                    # type.
+                    if tmpVolPreallocation != volParams['prealloc']:
+                        dstVol.setType(volParams['prealloc'])
 
                     dstChain.append(dstVol)
                 except se.StorageException:
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 9ce836b..7006a88 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -316,6 +316,14 @@
         return False
 
     @property
+    def lightweightPreallocation(self):
+        """
+        This property advertises whether creating preallocated volumes
+        is a lightweight operation or not.
+        """
+        return False
+
+    @property
     def oop(self):
         return oop.getProcessPool(self.sdUUID)
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I32811bd45320ef02bfc593a71dfdafc0b0550c7d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to