Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
CORTX-32172: Fixes ADDB client logs to bundled it in rgw support bundle
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Kumar <rahul.kumar@seagate.com>
  • Loading branch information
rahul27kumar committed Aug 18, 2022
1 parent 5acbb42 commit 79fd8b6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
19 changes: 16 additions & 3 deletions src/rgw/setup/rgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand All @@ -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)

Expand Down Expand Up @@ -147,17 +158,19 @@ 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)

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
Expand Down
5 changes: 3 additions & 2 deletions src/rgw/setup/rgw_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
raise SetupError(e, "Failed to start radosgw service. %s", e)

0 comments on commit 79fd8b6

Please sign in to comment.