Francesco Romani has uploaded a new change for review.

Change subject: stats: not log when disk stats are known missing
......................................................................

stats: not log when disk stats are known missing

There are some known cases on which the disk 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
stats case, to avoid to produce log noise when it is
expected to not have the disk stats.

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


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/27414/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 605a8a3..03f487a 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -341,10 +341,12 @@
                     dStats['imageID'] = vmDrive.imageID
                 elif "GUID" in vmDrive:
                     dStats['lunGUID'] = vmDrive.GUID
-                dStats['readRate'] = ((eInfo[dName][1] - sInfo[dName][1]) /
-                                      sampleInterval)
-                dStats['writeRate'] = ((eInfo[dName][3] - sInfo[dName][3]) /
-                                       sampleInterval)
+                if sInfo is not None:
+                    # will be None if sampled during recovery
+                    dStats['readRate'] = (
+                        (eInfo[dName][1] - sInfo[dName][1]) / sampleInterval)
+                    dStats['writeRate'] = (
+                        (eInfo[dName][3] - sInfo[dName][3]) / sampleInterval)
             except (AttributeError, KeyError, TypeError, ZeroDivisionError):
                 self._log.debug("Disk %s stats not available", dName)
 


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

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