From a868d7f726cbcc3503a525b177380ec1351665d4 Mon Sep 17 00:00:00 2001 From: Adam King Date: Mon, 25 Oct 2021 13:40:19 -0400 Subject: [PATCH] mgr/cephadm: inform users if limit set for data devices is not met Signed-off-by: Adam King (cherry picked from commit 212f88cbbc2b4edb7976a2abff27ed9b45c5ae3b) --- src/pybind/mgr/cephadm/services/osd.py | 16 ++++++++++++---- src/pybind/mgr/orchestrator/module.py | 5 ++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/cephadm/services/osd.py b/src/pybind/mgr/cephadm/services/osd.py index 5105e042db604..86000c042905c 100644 --- a/src/pybind/mgr/cephadm/services/osd.py +++ b/src/pybind/mgr/cephadm/services/osd.py @@ -204,12 +204,14 @@ class OSDService(CephService): [ {'data': {}, 'osdspec': , - 'host': + 'host': , + 'notes': }, {'data': ..., 'osdspec': .., - 'host': .. + 'host': ..., + 'notes': ... } ] @@ -246,10 +248,16 @@ class OSDService(CephService): except ValueError: logger.exception('Cannot decode JSON: \'%s\'' % ' '.join(out)) concat_out = {} - + notes = [] + if osdspec.data_devices is not None and osdspec.data_devices.limit and len(concat_out) < osdspec.data_devices.limit: + found = len(concat_out) + limit = osdspec.data_devices.limit + notes.append( + f'NOTE: Did not find enough disks matching filter on host {host} to reach data device limit (Found: {found} | Limit: {limit})') ret_all.append({'data': concat_out, 'osdspec': osdspec.service_id, - 'host': host}) + 'host': host, + 'notes': notes}) return ret_all def resolve_hosts_for_osdspecs(self, diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 1519fb35211a8..1128af69eae5f 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -159,6 +159,7 @@ def preview_table_osd(data: List) -> str: table.align = 'l' table.left_padding_width = 0 table.right_padding_width = 2 + notes = '' for osd_data in data: if osd_data.get('service_type') != 'osd': continue @@ -167,6 +168,8 @@ def preview_table_osd(data: List) -> str: if spec.get('error'): return spec.get('message') dg_name = spec.get('osdspec') + if spec.get('notes', []): + notes += '\n'.join(spec.get('notes')) + '\n' for osd in spec.get('data', []): db_path = osd.get('block_db', '-') wal_path = osd.get('block_wal', '-') @@ -174,7 +177,7 @@ def preview_table_osd(data: List) -> str: if not block_data: continue table.add_row(('osd', dg_name, host, block_data, db_path, wal_path)) - return table.get_string() + return notes + table.get_string() def preview_table_services(data: List) -> str: -- 2.39.5