X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fpython-lttngust%2Flttngust%2Fagent.py;h=58845b569c70ad75076872f11ce2e9de767c1adc;hb=3287f48be61ef3491aff0a80b7185ac57b3d8a5d;hp=66dbbd5e2b5efc00f5cc8b263f2f1aeffc29f94f;hpb=8bc1125eb851b2c52d3263c2992e6806017e98e7;p=lttng-ust.git diff --git a/src/python-lttngust/lttngust/agent.py b/src/python-lttngust/lttngust/agent.py index 66dbbd5e..58845b56 100644 --- a/src/python-lttngust/lttngust/agent.py +++ b/src/python-lttngust/lttngust/agent.py @@ -266,6 +266,14 @@ def _get_port_from_file(path): return port +def _get_ust_app_path(): + paths = os.getenv('LTTNG_UST_APP_PATH') + if paths is None: + return paths + paths = paths.split(':') + if len(paths) > 1: + dbg._pwarning("':' separator in LTTNG_UST_APP_PATH, only the first path will be used") + return paths[0] def _get_user_home_path(): # $LTTNG_HOME overrides $HOME if it exists @@ -298,15 +306,25 @@ def _init_threads(): 'lttng'.encode().decode() _initialized = True - sys_port = _get_port_from_file('/var/run/lttng/agent.port') - user_port_file = os.path.join(_get_user_home_path(), '.lttng', 'agent.port') - user_port = _get_port_from_file(user_port_file) + + # The LTTNG_UST_APP_PATH environment variables disables connections + # to the global and per-user session daemons. + if _get_ust_app_path() is not None: + ust_app_port_file = os.path.join(_get_ust_app_path(), 'agent.port') + ust_app_port = _get_port_from_file(ust_app_port_file) + sys_port = None + user_port = None + dbg._pdebug('ust_app session daemon port: {}'.format(ust_app_port)) + else: + sys_port = _get_port_from_file('/var/run/lttng/agent.port') + user_port_file = os.path.join(_get_user_home_path(), '.lttng', 'agent.port') + user_port = _get_port_from_file(user_port_file) + dbg._pdebug('system session daemon port: {}'.format(sys_port)) + dbg._pdebug('user session daemon port: {}'.format(user_port)) + reg_queue = queue.Queue() reg_expecting = 0 - dbg._pdebug('system session daemon port: {}'.format(sys_port)) - dbg._pdebug('user session daemon port: {}'.format(user_port)) - if sys_port == user_port and sys_port is not None: # The two session daemon ports are the same. This is not normal. # Connect to only one. @@ -314,6 +332,16 @@ def _init_threads(): sys_port = None try: + if ust_app_port is not None: + dbg._pdebug('creating ust_app client thread') + t = threading.Thread(target=_client_thread_target, + args=('ust_app', ust_app_port, reg_queue)) + t.name = 'ust_app' + t.daemon = True + t.start() + dbg._pdebug('created and started ust_app client thread') + reg_expecting += 1 + if sys_port is not None: dbg._pdebug('creating system client thread') t = threading.Thread(target=_client_thread_target,