Change in vdsm[master]: lib: set system name for threads

fromani at redhat.com fromani at redhat.com
Tue Mar 22 14:23:42 UTC 2016


Francesco Romani has uploaded a new change for review.

Change subject: lib: set system name for threads
......................................................................

lib: set system name for threads

To make the troubleshooting easier, we want
to set meaningful system names for our threads, so
we can use system tools (top, ps) to learn what Vdsm is doing.

The problem is that the system thread name must be at most
15 ASCII character long, while python's thread name could be
any legal string

A good shortening algorithm failed to emerge, so we
just truncate the possibly long python name and we use the truncated
name for system thread name.

Change-Id: I165f5ce9c86dad407d956a3b07e247431f2eed41
Bug-Url: https://bugzilla.redhat.com/1141422
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M lib/vdsm/concurrent.py
M lib/vdsm/executor.py
2 files changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/74/55074/1

diff --git a/lib/vdsm/concurrent.py b/lib/vdsm/concurrent.py
index 71eb341..1f9f215 100644
--- a/lib/vdsm/concurrent.py
+++ b/lib/vdsm/concurrent.py
@@ -22,6 +22,7 @@
 import threading
 from collections import namedtuple
 
+from . import pthread
 from . import utils
 
 
@@ -174,6 +175,8 @@
 
     @utils.traceback(on=logger)
     def run():
+        if name is not None:
+            pthread.setname(name[:15])
         return func(*args, **kwargs)
 
     thread = threading.Thread(target=run, name=name)
diff --git a/lib/vdsm/executor.py b/lib/vdsm/executor.py
index 9c9c218..37a9a9e 100644
--- a/lib/vdsm/executor.py
+++ b/lib/vdsm/executor.py
@@ -171,7 +171,6 @@
         self._thread.join()
 
     def _run(self):
-        pthread.setname(self.name[:15])
         self._log.debug('Worker started')
         try:
             while True:


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

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