Change in vdsm[master]: virt: Fix wrong usage of apparentsize and truesize

nsoffer at redhat.com nsoffer at redhat.com
Mon Feb 16 18:01:20 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: virt: Fix wrong usage of apparentsize and truesize
......................................................................

virt: Fix wrong usage of apparentsize and truesize

Drive extension and live-merge code was assuming that apparentsize is
the volume allocated size, and truesize is the virtual volume size.
Looking in the schema, file-based storage implementation, and engine, it
is clear that this is wrong. The reason that this code works, is that in
block storage we do not implement apparentsize, so apparentsize is
always equal to truesize.

This patch switch the usage of apparentsize and truesize in code
handling only block stoage. Code that handle both file and block storage
is correct.

Since apparentsize and truesize are the same in block storage, this
patch does not change the behavior of the system. However, it is
required for the next patch, implementing apparentsize in block storage.

Change-Id: Ie447f40df0dae496c2400d0af9d81247ab5740a5
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 9 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/37834/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 04f1a67..88f4783 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1461,9 +1461,9 @@
 
         for drive, volumeID, capacity, alloc, physical in extend:
             self.log.info(
-                "Requesting extension for volume %s on domain %s (apparent: "
+                "Requesting extension for volume %s on domain %s (truesize: "
                 "%s, capacity: %s, allocated: %s, physical: %s)",
-                volumeID, drive.domainID, drive.apparentsize, capacity,
+                volumeID, drive.domainID, drive.truesize, capacity,
                 alloc, physical)
             self.extendDriveVolume(drive, volumeID, physical, capacity)
 
@@ -1518,9 +1518,9 @@
 
         self.log.debug("Verifying extension for volume %s, requested size %s, "
                        "current size %s", volInfo['volumeID'],
-                       volInfo['newSize'], apparentSize)
+                       volInfo['newSize'], trueSize)
 
-        if apparentSize < volInfo['newSize']:
+        if trueSize < volInfo['newSize']:
             raise RuntimeError(
                 "Volume extension failed for %s (domainID: %s, volumeID: %s)" %
                 (volInfo['name'], volInfo['domainID'], volInfo['volumeID']))
@@ -3356,8 +3356,8 @@
         # We need to stop the collection of the stats for two reasons, one
         # is to prevent spurious libvirt errors about missing drive paths
         # (since we're changing them), and also to prevent to trigger a drive
-        # extension for the new volume with the apparent size of the old one
-        # (the apparentsize is updated as last step in updateDriveParameters)
+        # extension for the new volume with the true size of the old one (the
+        # true is updated as last step in updateDriveParameters).
         self.stopDisksStatsCollection()
 
         try:
@@ -4740,8 +4740,8 @@
             flags |= libvirt.VIR_DOMAIN_BLOCK_COMMIT_ACTIVE
 
             # If top is the active layer, it's allocated size is stored in
-            # drive.apparantsize.
-            topSize = drive.apparentsize
+            # the drive.truesize.
+            topSize = drive.truesize
         else:
             # If top is an internal volume, we must call getVolumeInfo
             res = self.cif.irs.getVolumeInfo(drive.domainID, drive.poolID,
@@ -4750,7 +4750,7 @@
                 self.log.error("Unable to get volume info for '%s'",
                                topVolUUID)
                 return errCode['mergeErr']
-            topSize = int(res['info']['apparentsize'])
+            topSize = int(res['info']['truesize'])
 
         # Take the jobs lock here to protect the new job we are tracking from
         # being cleaned up by queryBlockJobs() since it won't exist right away


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie447f40df0dae496c2400d0af9d81247ab5740a5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list