]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: inform users if limit set for data devices is not met
authorAdam King <adking@redhat.com>
Mon, 25 Oct 2021 17:40:19 +0000 (13:40 -0400)
committerSebastian Wagner <sewagner@redhat.com>
Wed, 17 Nov 2021 10:25:57 +0000 (11:25 +0100)
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 212f88cbbc2b4edb7976a2abff27ed9b45c5ae3b)

src/pybind/mgr/cephadm/services/osd.py
src/pybind/mgr/orchestrator/module.py

index 5105e042db6043252c9f906ab6fe960c7ce92105..86000c042905c5e620972012d58edc9919e0e86b 100644 (file)
@@ -204,12 +204,14 @@ class OSDService(CephService):
         [
           {'data': {<metadata>},
            'osdspec': <name of osdspec>,
-           'host': <name of host>
+           'host': <name of host>,
+           'notes': <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,
index 1519fb35211a805dfe4243f9de12b737d64584f8..1128af69eae5fbbea8918313c0f10e4eafc817e3 100644 (file)
@@ -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: