Francesco Romani has uploaded a new change for review.
Change subject: sampling: simplify flows
......................................................................
sampling: simplify flows
Executor already has a fallback net for uncaught exceptions.
Failures in SampleVMs.__call__ are expected to be sporadic,
and in these cases we actually want to be as much noisy as we
can.
This patch removes redundant code in SampleVMs.__call__,
to make the flow less convoluted.
Change-Id: Ide103d0ed9a694cc9ddd9b0b382e2d81a1bd48c0
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/sampling.py
1 file changed, 17 insertions(+), 21 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/40326/1
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index 09ce2b3..5a205f7 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -507,27 +507,23 @@
# we are deep in the hot path. bool(ExpiringCache)
# *is* costly so we should avoid it if we can.
fast_path = (self._sampling.empty and not self._skip_doms)
- try:
- with self._sampling.performer():
- if fast_path:
- # This is expected to be the common case.
- # If everything's ok, we can skip all the costly checks.
- bulk_stats = self._conn.getAllDomainStats(
- self._stats_flags)
- else:
- # A previous call got stuck, or not every domain
- # has properly recovered. Thus we must whitelist domains.
- doms = self._get_responsive_doms()
- self._log.debug('sampling %d domains', len(doms))
- if doms:
- bulk_stats = self._conn.domainListGetStats(
- doms, self._stats_flags)
- else:
- bulk_stats = []
- except Exception:
- self._log.exception("vm sampling failed")
- else:
- self._stats_cache.put(_translate(bulk_stats), timestamp)
+
+ with self._sampling.performer():
+ if fast_path:
+ # This is expected to be the common case.
+ # If everything's ok, we can skip all the costly checks.
+ bulk_stats = self._conn.getAllDomainStats(
+ self._stats_flags)
+ self._stats_cache.put(_translate(bulk_stats), timestamp)
+ else:
+ # A previous call got stuck, or not every domain
+ # has properly recovered. Thus we must whitelist domains.
+ doms = self._get_responsive_doms()
+ self._log.debug('sampling %d domains', len(doms))
+ if doms:
+ bulk_stats = self._conn.domainListGetStats(
+ doms, self._stats_flags)
+ self._stats_cache.put(_translate(bulk_stats), timestamp)
def _get_responsive_doms(self):
vms = self._get_vms()
--
To view, visit
https://gerrit.ovirt.org/40326
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide103d0ed9a694cc9ddd9b0b382e2d81a1bd48c0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>