]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm:Enable cephadm device scan to use LSM
authorPaul Cuzner <pcuzner@redhat.com>
Mon, 22 Feb 2021 01:35:03 +0000 (14:35 +1300)
committerPaul Cuzner <pcuzner@redhat.com>
Tue, 2 Mar 2021 20:24:35 +0000 (09:24 +1300)
Using libstoragemgmt (LSM) in ceph-volume was disabled by default,
(nov 2020) which meant cephadm's inventory never had a way to
request the LSM data. This patch adds a module option called
'device_enhanced_scan' (bool), that if set will append the
--with-lsm parameter to the ceph-volume inventory call.

Signed-off-by: Paul Cuzner <pcuzner@redhat.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/serve.py

index afd9314dead8ca0af4d7492ce2beaa298bffb2b6..b3421b6543767fdea6baa46d83bc62271e79a517 100644 (file)
@@ -163,6 +163,12 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
             default=30 * 60,
             desc='seconds to cache device inventory',
         ),
+        Option(
+            'device_enhanced_scan',
+            type='bool',
+            default=False,
+            desc='Use libstoragemgmt during device scans',
+        ),
         Option(
             'daemon_cache_timeout',
             type='secs',
index ee21e1cd9b7be3a30820de5cf0389d20cd47781d..501536d3991d91656d2f9bd331c7c9004390c069 100644 (file)
@@ -309,14 +309,24 @@ class CephadmServe:
         return None
 
     def _refresh_host_devices(self, host: str) -> Optional[str]:
+
+        with_lsm = self.mgr.get_module_option('device_enhanced_scan')
+        inventory_args = ['--', 'inventory',
+                          '--format=json',
+                          '--filter-for-batch']
+        if with_lsm:
+            inventory_args.insert(-1, "--with-lsm")
+
         try:
             try:
                 devices = self._run_cephadm_json(host, 'osd', 'ceph-volume',
-                                                 ['--', 'inventory', '--format=json', '--filter-for-batch'])
+                                                 inventory_args)
             except OrchestratorError as e:
                 if 'unrecognized arguments: --filter-for-batch' in str(e):
+                    rerun_args = inventory_args.copy()
+                    rerun_args.remove('--filter-for-batch')
                     devices = self._run_cephadm_json(host, 'osd', 'ceph-volume',
-                                                     ['--', 'inventory', '--format=json'])
+                                                     rerun_args)
                 else:
                     raise