Change in vdsm[master]: vdsm: update size of LUN volume in prepareVolume

derez at redhat.com derez at redhat.com
Sun Jan 5 16:36:43 UTC 2014


Daniel Erez has uploaded a new change for review.

Change subject: vdsm: update size of LUN volume in prepareVolume
......................................................................

vdsm: update size of LUN volume in prepareVolume

In order to handle resize of DirectLUN disks
(i.e. when a LUN volume is extended by user),
relevant data should be retrieved when invoking getVmStats.

Hence, added the following information to disks stats for
DirectLUN disks: truesize, apparentsize and lunGUID
(the sizes values already exist but are zeroed).
Using these values, the engine could keep the DB updated.

The following changes are introduced:

* hsm:
  Added getLunVolumeSize for fetching LUN's device size
  using blockSD -> _tellEnd.

* clientIF:
  For LUN devices, updated drive's truesize/apparentsize
  using getLunVolumeSize method.

* vm:
  _getDiskStats -> in order to identify each LUN
  (e.g. on engine side), added 'lunGUID' to dStats
  when vmDrive.GUID exists (applicable for DirectLUN disks).

Change-Id: I48b4343c6519fed366beec415c47226d4e3c8fef
Bug-Url: https://bugzilla.redhat.com/961532
Signed-off-by: Daniel Erez <derez at redhat.com>
---
M vdsm/clientIF.py
M vdsm/storage/hsm.py
M vdsm/vm.py
3 files changed, 28 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/22976/1

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 565d6ee..338df74 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -268,6 +268,11 @@
                 if res['status']['code']:
                     raise vm.VolumeError(drive)
 
+                # Update size for LUN volume
+                volSize = self.irs.getLunVolumeSize(volPath)
+                drive["truesize"] = volSize['truesize']
+                drive["apparentsize"] = volSize['apparentsize']
+
             # UUID drive format
             elif "UUID" in drive:
                 volPath = self._getUUIDSpecPath(drive["UUID"])
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 6bae0bd..513ead1 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3019,6 +3019,26 @@
                                          volUUID=volUUID).refreshVolume()
 
     @public
+    def getLunVolumeSize(self, volPath, options=None):
+        """
+        Gets the size of a LUN volume.
+
+        :param volPath: The LUN volume path.
+        :type volPath: string
+
+        :returns: a dict with the size of the volume.
+        :rtype: dict
+        """
+        try:
+            size = str(blockSD._tellEnd(volPath))
+        except IOError:
+            self.log.warn("Could not get size of LUN device in volPath %s",
+                          volPath, exc_info=True)
+            raise
+
+        return dict(truesize=size, apparentsize=size)
+
+    @public
     def getVolumeSize(self, sdUUID, spUUID, imgUUID, volUUID, options=None):
         """
         Gets the size of a volume.
@@ -3034,7 +3054,7 @@
         :param options: ?
 
         :returns: a dict with the size of the volume.
-        :rtype: dict
+        :rtype: dict/usr/share/vdsm
         """
         # Return string because xmlrpc's "int" is very limited
         dom = sdCache.produce(sdUUID=sdUUID)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 6467e0e..a98f073 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -622,6 +622,8 @@
                           'apparentsize': str(vmDrive.apparentsize)}
                 if vmDrive.isVdsmImage():
                     dStats['imageID'] = vmDrive.imageID
+                if vmDrive.GUID:
+                    dStats['lunGUID'] = vmDrive.GUID
                 dStats['readRate'] = ((eInfo[dName][1] - sInfo[dName][1]) /
                                       sampleInterval)
                 dStats['writeRate'] = ((eInfo[dName][3] - sInfo[dName][3]) /


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48b4343c6519fed366beec415c47226d4e3c8fef
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Daniel Erez <derez at redhat.com>


More information about the vdsm-patches mailing list