Change in vdsm[master]: virt: sampling: omit stacktrace if no cpu stats

fromani at redhat.com fromani at redhat.com
Wed Jun 17 09:31:23 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: virt: sampling: omit stacktrace if no cpu stats
......................................................................

virt: sampling: omit stacktrace if no cpu stats

Cpu stats may be temporarily unavailable.
Unrecoverable errors are rare. However,
in any case a warning is sufficient, and
a stack trace nowadays only adds noise
and confusion.

Change-Id: I894a0ace8e3dce3cf3399ed71942e41f719133fb
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vmstats.py
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/42476/1

diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index b9caeac..e11a3d2 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -34,7 +34,7 @@
 
     stats = {}
 
-    cpu(stats, first_sample, last_sample, interval)
+    cpu(vm, stats, first_sample, last_sample, interval)
     networks(vm, stats, first_sample, last_sample, interval)
     disks(vm, stats, first_sample, last_sample, interval)
     balloon(vm, stats, last_sample)
@@ -68,16 +68,17 @@
     stats['ioTune'] = io_tune_info
 
 
-def cpu(stats, first_sample, last_sample, interval):
+def cpu(vm, stats, first_sample, last_sample, interval):
     stats['cpuUser'] = 0.0
     stats['cpuSys'] = 0.0
 
     if first_sample is None or last_sample is None:
         return
+
     if interval <= 0:
         logging.warning(
-            'invalid interval %i when computing CPU stats',
-            interval)
+            'invalid interval %i when computing CPU stats for %s',
+            interval, vm.id)
         return
 
     try:
@@ -95,7 +96,7 @@
             interval)
 
     except KeyError as e:
-        logging.exception("CPU stats not available: %s", e)
+        logging.warning("CPU stats not available for %s", vm.id)
 
 
 def balloon(vm, stats, sample):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I894a0ace8e3dce3cf3399ed71942e41f719133fb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list