Francesco Romani has uploaded a new change for review.

Change subject: vm: use constants for monitorResponse field
......................................................................

vm: use constants for monitorResponse field

This patch introduces constants for the monitorResponse
key. No functional changes.

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


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/33960/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 3a98880..6b28275 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -104,6 +104,10 @@
 # reset monitor to responsive after x seconds
 _MONITOR_RESPONSIVE_INTERVAL = 10
 
+MONITOR_RESPONSIVE = '0'
+
+MONITOR_UNRESPONSIVE = '-1'
+
 
 def _listDomains():
     libvirtCon = libvirtconnection.get()
@@ -2467,7 +2471,8 @@
         """
         stats = {
             'elapsedTime': str(int(time.time() - self._startTime)),
-            'monitorResponse': '0' if self.isResponsive() else '-1',
+            'monitorResponse': (MONITOR_RESPONSIVE if self.isResponsive()
+                                else MONITOR_UNRESPONSIVE),
             'timeOffset': self.conf.get('timeOffset', '0'),
             'clientIp': self.conf.get('clientIp', ''),
             'network': {},
@@ -5611,11 +5616,11 @@
     def _setUnresponsiveIfTimeout(self, stats, statsAge):
         if not self.isMigrating() and (
            statsAge > config.getint('vars', 'vm_command_timeout')):
-            if stats['monitorResponse'] != '-1':
+            if stats['monitorResponse'] != MONITOR_UNRESPONSIVE:
                 self.log.warning('monitor become unresponsive'
                                  ' (command timeout, age=%s)',
                                  statsAge)
-                stats['monitorResponse'] = '-1'
+                stats['monitorResponse'] = MONITOR_UNRESPONSIVE
 
 
 class LiveMergeCleanupThread(threading.Thread):


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

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