Change in vdsm[master]: lib: allow to set system thread names

nsoffer at redhat.com nsoffer at redhat.com
Mon May 18 12:06:18 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: lib: allow to set system thread names
......................................................................


Patch Set 2:

(2 comments)

https://gerrit.ovirt.org/#/c/41052/2/lib/vdsm/threadname.py
File lib/vdsm/threadname.py:

Line 50: def systemname(name):
Line 51:     """
Line 52:     Decorator to set set the system name for a thread body callable.
Line 53:     The system name must be an ASCII string at most 15 characters long.
Line 54:     """
Lets check the name here and fail:

    if len(name) > 15:
        raise ValueError ...

This will fail when importing the module using the decorator.
Line 55:     def decorator(func):
Line 56:         @functools.wraps(func)
Line 57:         def wrapper(*args, **kwargs):
Line 58:             thread = threading.current_thread()


Line 57:         def wrapper(*args, **kwargs):
Line 58:             thread = threading.current_thread()
Line 59:             try:
Line 60:                 set_system_name(thread, name)
Line 61:             except RuntimeError:
> I believe we should swallow silently ValueError here, right?
Failing here is too late - we should fail when creating the decorator.

Lets not handle this as it should never fail if we filter bad names when creating the decorator.
Line 62:                 pass
Line 63:             return func(*args, **kwargs)
Line 64:         return wrapper


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib96bd0471a07449d2a0a0328137e8437aefad901
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list