Francesco Romani has uploaded a new change for review.

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
Bug-Url: https://bugzilla.redhat.com/1382578
Signed-off-by: Francesco Romani <from...@redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 12 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/65504/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index e3974e3..dc6ffe9 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4667,13 +4667,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 become unresponsive'
+                         ' (command timeout, age=%s)',
+                         statsAge)
+        stats['monitorResponse'] = '-1'
 
     def updateNumaInfo(self):
         self._numaInfo = numa.getVmNumaNodeRuntimeInfo(self)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53e9c284962f7ebe3987e460e4d138f2a08704dc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <from...@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