Change in vdsm[ovirt-3.4]: vm: Update LUN size when starting a vm

derez at redhat.com derez at redhat.com
Sun Feb 16 18:32:06 UTC 2014


Hello Nir Soffer, Federico Simoncelli,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/24527

to review the following change.

Change subject: vm: Update LUN size when starting a vm
......................................................................

vm: Update LUN size when starting a vm

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:
  appropriateDevice method now fetches LUN's device size
  using 'multipath -> getDeviceSize'.
* clientIF:
  For LUN devices, updated drive's truesize/apparentsize
  using hsm's getVolumeSize 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: Ia4988212f7f96078e774d2a4e7b5cd1681383cb0
Bug-Url: https://bugzilla.redhat.com/1026868
Signed-off-by: Daniel Erez <derez at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/24235
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/clientIF.py
M vdsm/storage/hsm.py
M vdsm/vm.py
3 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/24527/1

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 67dacab..3d354b3 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -263,6 +263,10 @@
                 if res['status']['code']:
                     raise vm.VolumeError(drive)
 
+                # Update size for LUN volume
+                drive["truesize"] = res['truesize']
+                drive["apparentsize"] = res['apparentsize']
+
                 volPath = os.path.join("/dev/mapper", drive["GUID"])
 
             # UUID drive format
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 53c9dd0..fbe3dbb 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3107,6 +3107,13 @@
                     expectedException=OSError,
                     timeout=QEMU_READABLE_TIMEOUT)
 
+        # Get the size of the logical unit volume.
+        # Casting to string for keeping consistency with public methods
+        # that use it to overcome xmlrpc integer size limitation issues.
+        size = str(multipath.getDeviceSize(devicemapper.getDmId(guid)))
+
+        return dict(truesize=size, apparentsize=size)
+
     @public
     def inappropriateDevices(self, thiefId):
         """
diff --git a/vdsm/vm.py b/vdsm/vm.py
index d3d47ab..b2bd980 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -635,6 +635,8 @@
                           'apparentsize': str(vmDrive.apparentsize)}
                 if isVdsmImage(vmDrive):
                     dStats['imageID'] = vmDrive.imageID
+                elif "GUID" in vmDrive:
+                    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/24527
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4988212f7f96078e774d2a4e7b5cd1681383cb0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list