]> 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)
committerSage Weil <sage@newdream.net>
Tue, 16 Mar 2021 12:56:17 +0000 (07:56 -0500)
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>
(cherry picked from commit 3105fa254b70f0fb56c86eb110580108dcd03509)

src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/serve.py

index 6e7398d660c9c244a65bbab2aae6b5877138c532..0aa487d8edf5f04385569a10ff8240ae41db9d51 100644 (file)
@@ -145,6 +145,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 2c0f67c1b0118915fb505816523f3d046cb3d678..4cb0ecc746340fde69f0b6349cb2d3aca686d8d6 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