From 79fd8b6ca9ab280917a1eb2ad767ca6116dc676e Mon Sep 17 00:00:00 2001 From: Rahul Kumar Date: Tue, 2 Aug 2022 05:31:56 -0600 Subject: [PATCH] CORTX-32172: Fixes ADDB client logs to bundled it in rgw support bundle Signed-off-by: Rahul Kumar --- src/rgw/setup/rgw.py | 19 ++++++++++++++++--- src/rgw/setup/rgw_service.py | 5 +++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/rgw/setup/rgw.py b/src/rgw/setup/rgw.py index 2ea0e4b..54751f5 100644 --- a/src/rgw/setup/rgw.py +++ b/src/rgw/setup/rgw.py @@ -90,7 +90,7 @@ def prepare(conf: MappedConf): return 0 @staticmethod - def config(conf: MappedConf): + def config(conf: MappedConf, index: str = '1'): """Performs configurations.""" Log.info('Config phase started.') @@ -117,6 +117,17 @@ def config(conf: MappedConf): os.environ['M0_TRACE_DIR'] = motr_trace_dir Log.info('Created motr trace directory : %s' % os.environ.get('M0_TRACE_DIR')) + # Create motr addb directory for collecting addb files + # in case admin user creation issue during mini-provisioner execution. + Log.info('Creating motr addb_files- directory for collecting addb files..') + motr_fid_key = const.MOTR_MY_FID % index + motr_fid_value = Conf.get(Rgw._conf_idx, motr_fid_key) + log_path = Rgw._get_log_dir_path(conf) + addb_dir = os.path.join(log_path, f'addb_files-{motr_fid_value}') + os.makedirs(addb_dir, exist_ok=True) + os.environ['M0_CLIENT_ADDB_DIR'] = addb_dir + Log.info('Created addb-files- directory : %s' % os.environ.get('M0_CLIENT_ADDB_DIR')) + # Change current working directory to rgw_debug for core file generation Rgw._change_working_dir(conf) @@ -147,9 +158,11 @@ def start(conf: MappedConf, index: str): motr_fid_value = Conf.get(Rgw._conf_idx, motr_fid_key) log_path = Rgw._get_log_dir_path(conf) motr_trace_dir = os.path.join(log_path, 'motr_trace_files') - addb_dir = os.path.join(log_path, f'addb_files-{motr_fid_value}') os.makedirs(motr_trace_dir, exist_ok=True) + + addb_dir = os.path.join(log_path, f'addb_files-{motr_fid_value}') os.makedirs(addb_dir, exist_ok=True) + # Create rgw crash file directory rgw_core_dir = os.path.join(log_path, 'rgw_debug') os.makedirs(rgw_core_dir, exist_ok=True) @@ -157,7 +170,7 @@ def start(conf: MappedConf, index: str): Log.info('Starting radosgw service.') log_file = os.path.join(log_path, f'{const.COMPONENT_NAME}_startup.log') - RgwService.start(conf, config_file, log_file, motr_trace_dir, rgw_core_dir, index) + RgwService.start(conf, config_file, log_file, motr_trace_dir, addb_dir, rgw_core_dir, index) Log.info("Started radosgw service.") return 0 diff --git a/src/rgw/setup/rgw_service.py b/src/rgw/setup/rgw_service.py index d6194aa..1ee1f3e 100755 --- a/src/rgw/setup/rgw_service.py +++ b/src/rgw/setup/rgw_service.py @@ -27,10 +27,11 @@ class RgwService: """Entrypoint class for RGW.""" @staticmethod - def start(conf: MappedConf, config_file, log_file, motr_trace_dir, rgw_cwd, index: str = '1',): + def start(conf: MappedConf, config_file, log_file, motr_trace_dir, addb_dir, rgw_cwd, index: str = '1',): """Start rgw service independently.""" try: os.environ['M0_TRACE_DIR'] = motr_trace_dir + os.environ['M0_CLIENT_ADDB_DIR'] = addb_dir cmd = os.path.join(INSTALL_PATH, COMPONENT_NAME, 'bin/radosgw_start') sys.stdout.flush() sys.stderr.flush() @@ -40,4 +41,4 @@ def start(conf: MappedConf, config_file, log_file, motr_trace_dir, rgw_cwd, inde raise SetupError(e.errno, "Failed to start radosgw service. %s", e) except Exception as e: Log.error(f"Failed to start radosgw service:{e}") - raise SetupError(e, "Failed to start radosgw service. %s", e) \ No newline at end of file + raise SetupError(e, "Failed to start radosgw service. %s", e)