Francesco Romani has uploaded a new change for review. Change subject: sampling: do not bail out on errors ......................................................................
sampling: do not bail out on errors The current sampling code for host stats only handles TimeoutError gracefully. This is too fragile: the sampling code should not give up so easily but instead go ahead in face of errors, as the VmStatsThread already do. Change-Id: Icd05aecc0f66da2bc75f477afc5e17fada0e5f5b Relates-To: https://bugzilla.redhat.com/1113948 Signed-off-by: Francesco Romani <[email protected]> --- M vdsm/virt/sampling.py 1 file changed, 14 insertions(+), 17 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/29401/1 diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py index 3b91cee..9c011c5 100644 --- a/vdsm/virt/sampling.py +++ b/vdsm/virt/sampling.py @@ -482,23 +482,20 @@ def run(self): import vm - try: - # wait a bit before starting to sample - time.sleep(self.SAMPLE_INTERVAL_SEC) - while not self._stopEvent.isSet(): - try: - sample = self.sample() - self._samples.append(sample) - self._lastSampleTime = sample.timestamp - if len(self._samples) > self.AVERAGING_WINDOW: - self._samples.pop(0) - except vm.TimeoutError: - self._log.error("Timeout while sampling stats", - exc_info=True) - self._stopEvent.wait(self.SAMPLE_INTERVAL_SEC) - except: - if not self._stopEvent.isSet(): - self._log.error("Error while sampling stats", exc_info=True) + # wait a bit before starting to sample + time.sleep(self.SAMPLE_INTERVAL_SEC) + while not self._stopEvent.isSet(): + try: + sample = self.sample() + self._samples.append(sample) + self._lastSampleTime = sample.timestamp + if len(self._samples) > self.AVERAGING_WINDOW: + self._samples.pop(0) + except vm.TimeoutError: + self._log.exception("Timeout while sampling stats") + except Exception: + self._log.exception("Error while sampling stats") + self._stopEvent.wait(self.SAMPLE_INTERVAL_SEC) @utils.memoized def _boot_time(self): -- To view, visit http://gerrit.ovirt.org/29401 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icd05aecc0f66da2bc75f477afc5e17fada0e5f5b 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
