From: Paul Cuzner Date: Mon, 22 Feb 2021 01:35:03 +0000 (+1300) Subject: mgr/cephadm:Enable cephadm device scan to use LSM X-Git-Tag: v16.2.0~106^2~95 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5cd146231dca9e8d1782823e8c6a6dfb7f089c01;p=ceph.git mgr/cephadm:Enable cephadm device scan to use LSM 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 (cherry picked from commit 3105fa254b70f0fb56c86eb110580108dcd03509) --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 6e7398d660c..0aa487d8edf 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -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', diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 2c0f67c1b01..4cb0ecc7463 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -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