From: Sage Weil Date: Sat, 22 Feb 2020 13:33:48 +0000 (-0600) Subject: mgr/cephadm: catch exceptions when scraping ceph-volume inventory X-Git-Tag: v15.1.1~290^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=faaa53a89e37283cf3e7c8eb68c3f9d433050141;p=ceph.git mgr/cephadm: catch exceptions when scraping ceph-volume inventory This matches what we do with the background 'cephadm ls'. Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 2dd0e03f475..46ea9a71dbc 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1493,10 +1493,16 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): return None def _refresh_host_devices(self, host): - out, err, code = self._run_cephadm( - host, 'osd', - 'ceph-volume', - ['--', 'inventory', '--format=json']) + try: + out, err, code = self._run_cephadm( + host, 'osd', + 'ceph-volume', + ['--', 'inventory', '--format=json']) + if code: + return 'host %s ceph-volume inventory returned %d: %s' % ( + host, code, err) + except Exception as e: + return 'host %s ceph-volume inventory failed: %s' % (host, e) data = json.loads(''.join(out)) self.log.debug('Refreshed host %s devices: %s' % (host, data)) devices = inventory.Devices.from_json(data)