X-Git-Url: https://git.lttng.org/?p=lttng-ust.git;a=blobdiff_plain;f=src%2Fpython-lttngust%2Flttngust%2Fagent.py;fp=src%2Fpython-lttngust%2Flttngust%2Fagent.py;h=69caad69492d66d0e7b1a2a4a83c530c3547fea8;hp=66dbbd5e2b5efc00f5cc8b263f2f1aeffc29f94f;hb=c0f6fb054d2f16518d047a6adf7e8aa81eff5403;hpb=47bc09f338f3c1199a878f77b7b18be8d2a224f6 diff --git a/src/python-lttngust/lttngust/agent.py b/src/python-lttngust/lttngust/agent.py index 66dbbd5e..69caad69 100644 --- a/src/python-lttngust/lttngust/agent.py +++ b/src/python-lttngust/lttngust/agent.py @@ -266,6 +266,8 @@ def _get_port_from_file(path): return port +def _get_ust_app_path(): + return os.getenv('LTTNG_UST_APP_PATH') def _get_user_home_path(): # $LTTNG_HOME overrides $HOME if it exists @@ -298,15 +300,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 +326,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,