Hello Dan Kenigsberg, Milan Zamazal, Martin Polednik,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/65812

to review the following change.

Change subject: vm: reformat setUnresponsiveIfTimeout
......................................................................

vm: reformat setUnresponsiveIfTimeout

Reformat the order of operations to make clear
on which cases we don't care about timeouts.

Change-Id: I53e9c284962f7ebe3987e460e4d138f2a08704dc
Backport-To: 4.0
Backport-To: 3.6
Bug-Url: https://bugzilla.redhat.com/1382578
Bug-Url: https://bugzilla.redhat.com/1382583
Signed-off-by: Francesco Romani <from...@redhat.com>
Reviewed-on: https://gerrit.ovirt.org/65504
Continuous-Integration: Jenkins CI
Reviewed-by: Martin Polednik <mpoled...@redhat.com>
Reviewed-by: Milan Zamazal <mzama...@redhat.com>
Reviewed-by: Dan Kenigsberg <dan...@redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 12 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/65812/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 65c8731..5659ac5 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4835,13 +4835,18 @@
                       reason)
 
     def _setUnresponsiveIfTimeout(self, stats, statsAge):
-        if (not self.isMigrating()
-                and statsAge > config.getint('vars', 'vm_command_timeout')
-                and stats['monitorResponse'] != '-1'):
-            self.log.warning('monitor become unresponsive'
-                             ' (command timeout, age=%s)',
-                             statsAge)
-            stats['monitorResponse'] = '-1'
+        if self.isMigrating():
+            return
+        # we don't care about decimals here
+        if statsAge < config.getint('vars', 'vm_command_timeout'):
+            return
+        if stats['monitorResponse'] == '-1':
+            return
+
+        self.log.warning('monitor became unresponsive'
+                         ' (command timeout, age=%s)',
+                         statsAge)
+        stats['monitorResponse'] = '-1'
 
     def updateNumaInfo(self):
         self._numaInfo = numa.getVmNumaNodeRuntimeInfo(self)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53e9c284962f7ebe3987e460e4d138f2a08704dc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Martin Polednik <mpoled...@redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzama...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to