Adam Litke has uploaded a new change for review.
Change subject: HACK: Use a monitor command to get watermarks
......................................................................
HACK: Use a monitor command to get watermarks
Change-Id: I6b3e408fda22ac4a4cb11f58d399b9d69906d72e
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 27 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/28620/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 708872a..5c192f0 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2293,8 +2293,33 @@
self.conf['timeOffset'] = newTimeOffset
def _getMergeWriteWatermarks(self):
- # TODO: Adopt the future libvirt API
- return {}
+ ret = {}
+ cmd = {'execute': 'query-blockstats'}
+ resp = self._internalQMPMonitorCommand(cmd)
+ for device in resp['return']:
+ name = device['device']
+ if not name.startswith('drive-'):
+ continue
+ alias = name[6:]
+ try:
+ drive = self._lookupDeviceByAlias(DISK_DEVICES, alias)
+ job = self.getBlockJob(drive)
+ except LookupError:
+ continue
+
+ volChain = job['chain']
+ stats = []
+ vol = device
+ while vol:
+ stats.insert(0,
vol['parent']['stats']['wr_highest_offset'])
+ vol = vol.get('backing')
+ if len(volChain) != len(stats):
+ self.log.debug("The number of wr_highest_offset stats does "
+ "not match the number of volumes. Skipping.")
+ continue
+ for vol, stat in zip(volChain, stats):
+ ret[vol] = stat
+ return ret
def _getLiveMergeExtendCandidates(self):
ret = {}
--
To view, visit
http://gerrit.ovirt.org/28620
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b3e408fda22ac4a4cb11f58d399b9d69906d72e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>