Change in vdsm[ovirt-3.6]: periodic: add executor-compatible naming

fromani at redhat.com fromani at redhat.com
Wed Nov 11 09:32:23 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: periodic: add executor-compatible naming
......................................................................

periodic: add executor-compatible naming

We want to make as easy as possible to debug
thread leaks from executor, so we make the periodic
framework support names for Operations, using the
way Executor expects them.

Change-Id: If8d1180b727571cce34e8304ac48390ed2135f79
Bug-Url: https://bugzilla.redhat.com/1250839
Backport-To: 3.6
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/periodic.py
M vdsm/virt/sampling.py
2 files changed, 31 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/48416/1

diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index dc4049a..3791eae 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -199,6 +199,11 @@
         self._executor.dispatch(self, self._timeout)
         self._step()
 
+    def __str__(self):
+        return '<Operation action=%s at 0x%x>' % (
+            self._func, id(self)
+        )
+
 
 class VmDispatcher(object):
     """
@@ -246,8 +251,7 @@
 
             except Exception:
                 # we want to make sure to have VM UUID logged
-                self._log.exception("while dispatching %s to VM '%s'",
-                                    self._create, vm_id)
+                self._log.exception("while dispatching %s", op)
             else:
                 try:
                     self._executor.dispatch(op, self._timeout)
@@ -259,11 +263,18 @@
                               self._create, skipped)
         return skipped  # for testing purposes
 
-    def __repr__(self):
-        return 'VmDispatcher(%s)' % self._create
+    def __str__(self):
+        return '<VmDispatcher operation=%s at 0x%x>' % (
+            self._create, id(self)
+        )
+
+    __repr__ = __str__
 
 
 class _RunnableOnVm(object):
+
+    NAME = "Operation"
+
     def __init__(self, vm):
         self._vm = vm
 
@@ -284,8 +295,15 @@
     def _execute(self):
         raise NotImplementedError
 
+    def __str__(self):
+        return '<%s vm=%s at 0x%x>' % (
+            self.NAME, self._vm.id, id(self)
+        )
+
 
 class UpdateVolumes(_RunnableOnVm):
+
+    NAME = "UpdateVolumes"
 
     @property
     def required(self):
@@ -301,6 +319,8 @@
 
 
 class NumaInfoMonitor(_RunnableOnVm):
+
+    NAME = "NumaInfoMonitor"
 
     @property
     def required(self):
@@ -318,6 +338,8 @@
 
 class BlockjobMonitor(_RunnableOnVm):
 
+    NAME = "BlockjobMonitor"
+
     @property
     def required(self):
         # For performance reasons, we must avoid as much
@@ -333,6 +355,8 @@
 
 class DriveWatermarkMonitor(_RunnableOnVm):
 
+    NAME = "DriveWatermarkMonitor"
+
     @property
     def required(self):
         # Avoid queries from storage during recovery process
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index fac10d1..63192a2 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -558,6 +558,9 @@
                 doms.append(vm_obj._dom._dom)
         return doms
 
+    def __str__(self):
+        return "<VMBulkSampler at 0x%x>" % id(self)
+
 
 class HostStatsThread(threading.Thread):
     """


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

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


More information about the vdsm-patches mailing list