Francesco Romani has uploaded a new change for review. Change subject: sampling: hoststats: remove unneeded attribute ......................................................................
sampling: hoststats: remove unneeded attribute The HostStatsThread's sampleInterval instance attribute can easily be made a local variable. This patch does that. Change-Id: Ia995d558e80fb952a2b601e9ddb42fbae0d10470 Signed-off-by: Francesco Romani <[email protected]> --- M vdsm/virt/sampling.py 1 file changed, 7 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/47945/1 diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py index c13189d..f78f852 100644 --- a/vdsm/virt/sampling.py +++ b/vdsm/virt/sampling.py @@ -551,13 +551,8 @@ def __init__(self, samples=host_samples, clock=utils.monotonic_time): self._samples = samples - - self._pid = os.getpid() - - self._sampleInterval = \ - config.getint('vars', 'host_sample_stats_interval') - hoststats.start(clock) + self._pid = os.getpid() self._stopEvent = threading.Event() @@ -575,9 +570,13 @@ @utils.traceback(on=_log) def _run(self): + + sample_interval = config.getint( + 'vars', 'host_sample_stats_interval') + try: # wait a bit before starting to sample - time.sleep(self._sampleInterval) + time.sleep(sample_interval) while not self._stopEvent.isSet(): try: sample = HostSample(self._pid) @@ -591,7 +590,7 @@ self._CONNLOG.debug('%s', diff) except virdomain.TimeoutError: self._log.exception("Timeout while sampling stats") - self._stopEvent.wait(self._sampleInterval) + self._stopEvent.wait(sample_interval) except: if not self._stopEvent.isSet(): self._log.exception("Error while sampling stats") -- To view, visit https://gerrit.ovirt.org/47945 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia995d558e80fb952a2b601e9ddb42fbae0d10470 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
