Change in vdsm[master]: virt: sampling: add StatsCache

danken at redhat.com danken at redhat.com
Tue Mar 31 11:25:26 UTC 2015


Dan Kenigsberg has posted comments on this change.

Change subject: virt: sampling: add StatsCache
......................................................................


Patch Set 2: Code-Review-1

(3 comments)

https://gerrit.ovirt.org/#/c/39331/2/vdsm/virt/sampling.py
File vdsm/virt/sampling.py:

Line 402: 
Line 403: 
Line 404: class StatsCache(object):
Line 405:     def __init__(self, log=None):
Line 406:         self._log = (log if log is not None else
I see no reason to pass log as arg, at all. a static getLogger call seems enough.
Line 407:                      logging.getLogger("sampling.StatsCache"))
Line 408:         self._samples = SampleWindow(2)
Line 409:         self._last_sample_time = 0
Line 410: 


Line 410: 
Line 411:     def get(self, vmid):
Line 412:         first_batch, last_batch, interval = self._samples.stats()
Line 413:         if first_batch is None:
Line 414:             return (None, None, interval)
interval is always None in this case. Let's return None.
Line 415: 
Line 416:         first_sample = first_batch.get(vmid)
Line 417:         last_sample = last_batch.get(vmid)
Line 418:         return (first_sample, last_sample, interval)


Line 413:         if first_batch is None:
Line 414:             return (None, None, interval)
Line 415: 
Line 416:         first_sample = first_batch.get(vmid)
Line 417:         last_sample = last_batch.get(vmid)
What happens if a vm becomes non-responsive? nowadays, we keep reporting the last-known values (such as total bandwidth consumption) which are actually valid and important.

I have no simple solution to keep reporting them with bulk stats. I hope you can find one.
Line 418:         return (first_sample, last_sample, interval)
Line 419: 
Line 420:     def put(self, bulk_stats, monotonic_ts):
Line 421:         if monotonic_ts >= self._last_sample_time:


-- 
To view, visit https://gerrit.ovirt.org/39331
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I11d5069f49d54bb5f43a7c4914c7e4b9f8093db9
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list