Change in vdsm[master]: vm: per-attribute monitor response check

fromani at redhat.com fromani at redhat.com
Fri Jan 10 14:01:15 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: vm: per-attribute monitor response check
......................................................................

vm: per-attribute monitor response check

the responsiveness of the monitor is reported through a single
instance variable, which is updated after each libvirt call.

If one single call goes in timeout, while the others go well,
due to interplay between timeouts and polling interval, it can
happen that reported status bounces back and forth between 'Up'
and 'Not Responding'.

This patch address this behaviour by keeping track of the
timeouts per-dom-attribute instead of per-dom, and reports
the monitor as not respondig if, and until, at least one had
a timeout in the last call.

Change-Id: I32a98d34cde91fa9dc3d07f03c47a5f2f22da620
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/vm.py
1 file changed, 12 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/23138/1

diff --git a/vdsm/vm.py b/vdsm/vm.py
index 55683f4..9d7ca03 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -853,11 +853,11 @@
         def f(*args, **kwargs):
             try:
                 ret = attr(*args, **kwargs)
-                self._cb(False)
+                self._cb(False, name)
                 return ret
             except libvirt.libvirtError as e:
                 if e.get_error_code() == libvirt.VIR_ERR_OPERATION_TIMEOUT:
-                    self._cb(True)
+                    self._cb(True, name)
                     toe = TimeoutError(e.get_error_message())
                     toe.err = e.err
                     raise toe
@@ -1938,6 +1938,9 @@
 
         if (self.arch not in ['ppc64', 'x86_64']):
             raise RuntimeError('Unsupported architecture: %s' % self.arch)
+
+        self._attrTimeoutLock = threading.Lock()
+        self._attrTimeoutExperienced = {}  # will keep track of timeout data
 
     def _get_lastStatus(self):
         PAUSED_STATES = ('Powering down', 'RebootInProgress', 'Up')
@@ -3631,11 +3634,13 @@
     def _monitorDependentInit(self, timeout=None):
         self.log.warning('unsupported by libvirt vm')
 
-    def _timeoutExperienced(self, timeout):
-        if timeout:
-            self._monitorResponse = -1
-        else:
-            self._monitorResponse = 0
+    def _timeoutExperienced(self, timeout, attrName):
+        with self._attrTimeoutLock:
+            self._attrTimeoutExperienced[attrName] = timeout
+            if any(self._attrTimeoutExperienced.itervalues()):
+                self._monitorResponse = -1
+            else:
+                self._monitorResponse = 0
 
     def _waitForIncomingMigrationFinish(self):
         if 'restoreState' in self.conf:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I32a98d34cde91fa9dc3d07f03c47a5f2f22da620
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list