Francesco Romani has uploaded a new change for review.

Change subject: stats: not log when disk latency is known missing
......................................................................

stats: not log when disk latency is known missing

There are some known cases on which the disk latency stats
cannot be available, for example if recovery is in progress.

Those cases are already handled by the current code,
but their treatment is mixed with the handling of truly
exceptional cases, while the aforementioned cases are
expected errors, thus not 'exceptional' errors.

This patch add explicit handling for the missing disk
larency stats case, to avoid to produce log noise when it is
expected to not have the disk latency stats.

Change-Id: I1119ec792ff8aba6e5340efd0c1b7e2ee89a296f
Signed-off-by: Francesco Romani <[email protected]>
---
M vdsm/virt/vm.py
1 file changed, 12 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/27415/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 03f487a..2b4c023 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -381,15 +381,18 @@
             dLatency = {'readLatency': '0',
                         'writeLatency': '0',
                         'flushLatency': '0'}
-            try:
-                (dLatency['readLatency'],
-                 dLatency['writeLatency'],
-                 dLatency['flushLatency']) = _avgLatencyCalc(sInfo[dName],
-                                                             eInfo[dName])
-            except (KeyError, TypeError):
-                self._log.debug("Disk %s latency not available", dName)
-            else:
-                stats[dName].update(dLatency)
+
+            if sInfo is not None:
+                # will be None if sampled during recovery
+                try:
+                    (dLatency['readLatency'],
+                     dLatency['writeLatency'],
+                     dLatency['flushLatency']) = _avgLatencyCalc(
+                        sInfo[dName], eInfo[dName])
+                except (KeyError, TypeError):
+                    self._log.debug("Disk %s latency not available", dName)
+
+            stats[dName].update(dLatency)
 
     def get(self):
         stats = {}


-- 
To view, visit http://gerrit.ovirt.org/27415
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1119ec792ff8aba6e5340efd0c1b7e2ee89a296f
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

Reply via email to