So we can store scheduler and autoserv pid files in that alternate location.
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]> --- client/common_lib/base_utils.py | 16 ++++++++++++---- global_config.ini | 4 ++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/client/common_lib/base_utils.py b/client/common_lib/base_utils.py index 7483522..872a8fe 100644 --- a/client/common_lib/base_utils.py +++ b/client/common_lib/base_utils.py @@ -9,7 +9,9 @@ try: import hashlib except ImportError: import md5, sha -from autotest_lib.client.common_lib import error, logging_manager +from autotest_lib.client.common_lib import error, logging_manager, global_config + +GLOBAL_CONFIG = global_config.global_config def deprecated(func): """This is a decorator which can be used to mark functions as deprecated. @@ -1593,9 +1595,15 @@ def import_site_function(path, module, funcname, dummy, modulefile=None): def _get_pid_path(program_name): - my_path = os.path.dirname(__file__) - return os.path.abspath(os.path.join(my_path, "..", "..", - "%s.pid" % program_name)) + pid_files_dir = GLOBAL_CONFIG.get_config_value("SERVER", 'pid_files_dir') + if not pid_file_dir: + base_dir = os.path.dirname(__file__) + pid_path = os.path.abspath(os.path.join(base_dir, "..", "..", + "%s.pid" % program_name)) + else: + pid_path = os.path.join(pid_files_dir, "%s.pid" % program_name) + + return pid_path def write_pid(program_name): diff --git a/global_config.ini b/global_config.ini index df14f26..8e75e42 100644 --- a/global_config.ini +++ b/global_config.ini @@ -96,6 +96,10 @@ crash_collection_hours_to_wait: 4.0 # Specify a location to store the server log files #logs_dir: /var/log/autotest logs_dir: +# Specify a location to store the server pid files +#pid_files_dir: /var/run/autotest +pid_files_dir: + [SCHEDULER] # Whether to enable scheduler. -- 1.7.7.6 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
