Adam Litke has uploaded a new change for review.

Change subject: Live Merge: Extend internal block volumes during merge
......................................................................

Live Merge: Extend internal block volumes during merge

Libvirt will be exposing the high write watermark for internal volumes
directly in the domain XML.  An <allocation/> element will be added to
each member of the image chain.  This patch implements the missing logic
for _getMergeWriteWatermarks using this new API.

Change-Id: I3a9e0ebdb9c42df713c40e0fc5782945eb7228a8
Signed-off-by: Adam Litke <[email protected]>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1109920
---
M vdsm/virt/vm.py
1 file changed, 30 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/31268/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 25d75eb..19d45e6 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2063,9 +2063,36 @@
             self.conf['timeOffset'] = newTimeOffset
 
     def _getMergeWriteWatermarks(self):
-        # TODO: Adopt the future libvirt API when the following RFE is done
-        # https://bugzilla.redhat.com/show_bug.cgi?id=1041569
-        return {}
+        def findElement(doc, name):
+            for child in doc.childNodes:
+                if child.nodeName == name:
+                    return child
+            return None
+
+        ret = {}
+        domXML = self._getUnderlyingVmInfo()
+        for deviceXML, alias in _devicesWithAlias(domXML):
+            try:
+                drive = self._lookupDeviceByAlias(DISK_DEVICES, alias)
+                job = self.getBlockJob(drive)
+            except LookupError:
+                continue
+
+            volChain = job['chain']
+            stats = []
+            volXML = deviceXML
+            while volXML:
+                allocXML = findElement(volXML, 'allocation')
+                if allocXML:
+                    stats.insert(0, int(allocXML.firstChild.nodeValue))
+                volXML = findElement(volXML, 'backingStore')
+            if len(stats) != len(volChain):
+                self.log.debug("Volume allocation information not provided "
+                               "for drive %s, skipping", alias)
+                continue
+            for vol, stat in zip(volChain, stats):
+                ret[vol] = stat
+        return ret
 
     def _getLiveMergeExtendCandidates(self):
         ret = {}


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

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

Reply via email to