Francesco Romani has uploaded a new change for review.
Change subject: sampling: mom: add support for alien samplings
......................................................................
sampling: mom: add support for alien samplings
This patch allow a VM to do sampling callbacks
on behalf of other components. These samplings
are considered fully opaque:
they are just a callable without arguments and
an interval in seconds. The VM sampling code will
call periodically these samplings alongside
with the standard VM ones.
This feature will be used by MOM in a future patch
to avoid the need of one monitor thread per VM.
Change-Id: I7b689f11353192858238c587a721b4a9f9d33b9b
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 10 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/31608/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index ad1ef2f..a429016 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -206,7 +206,7 @@
# TODO: Remove as soon as there is a hard dependency we can use
_libvirt_metadata_supported = True
- def __init__(self, vm):
+ def __init__(self, vm, extraMonitors=None):
AdvancedStatsThread.__init__(self, log=vm.log, daemon=True)
self._vm = vm
@@ -265,6 +265,13 @@
self.sampleDisk, self.sampleDiskLatency, self.sampleNet,
self.sampleBalloon, self.sampleVmJobs, self.sampleVcpuPinning,
self.sampleCpuTune)
+
+ extraMonitors = (tuple() if extraMonitors is None
+ else tuple(extraMonitors))
+ self.addStatsFunction(
+ AdvancedStatsFunction(mon.collect, mon.interval,
+ self.GENERIC_SAMPLING_WINDOW)
+ for mon in extraMonitors)
def _highWrite(self):
if not self._vm.isDisksStatsCollectionEnabled():
@@ -2732,8 +2739,8 @@
return domxml.toxml()
- def _initVmStats(self):
- self._vmStats = VmStatsThread(self)
+ def _initVmStats(self, extraMonitors=None):
+ self._vmStats = VmStatsThread(self, extraMonitors)
self._vmStats.start()
self._guestEventTime = self._startTime
--
To view, visit
http://gerrit.ovirt.org/31608
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b689f11353192858238c587a721b4a9f9d33b9b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>