Change in vdsm[master]: vm: Monitor replicated file based drive

nsoffer at redhat.com nsoffer at redhat.com
Thu Jan 22 17:55:37 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: vm: Monitor replicated file based drive
......................................................................

vm: Monitor replicated file based drive

blockInfo work only for block devices. For file based devices, we get
the current volume size using the storage layer.

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


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/35/37235/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index bda6be5..6a2465f 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1412,9 +1412,23 @@
             if not drive.supportsExtension():
                 continue
 
-            # TODO: Does this work for file based disks? If not, we need to
-            # check replica path (one of them must be block based).
-            capacity, alloc, physical = self._dom.blockInfo(drive.path, 0)
+            if drive.blockDev:
+                capacity, alloc, physical = self._dom.blockInfo(drive.path, 0)
+            else:
+                # TODO: This code is repeated many times in this module, should
+                # have a helper for this.
+                res = self.cif.irs.getVolumeSize(
+                    drive.domainID, drive.poolID, drive.imageID,
+                    drive.volumeID)
+                if res['status']['code'] != 0:
+                    self.log.error(
+                        "Error getting volume %s size for drive %s on domain "
+                        " %s", drive.volumeID, drive.name, drive.domainID)
+                    continue
+                alloc = int(res["truesize"])
+                # TODO: Is this correct? Use volume size instead?
+                physical = capacity = int(res["apparentsize"])
+
             ret.append((drive, drive.volumeID, capacity, alloc, physical))
 
             try:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I411ba217c11a9ca64f5562ad43f3fe9af8be52ac
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