]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: catch exceptions when scraping ceph-volume inventory 33484/head
authorSage Weil <sage@redhat.com>
Sat, 22 Feb 2020 13:33:48 +0000 (07:33 -0600)
committerSage Weil <sage@redhat.com>
Sat, 22 Feb 2020 13:33:48 +0000 (07:33 -0600)
This matches what we do with the background 'cephadm ls'.

Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/cephadm/module.py

index 2dd0e03f475395e089fca30824265ad82669a209..46ea9a71dbc242f0cd63fd5d56e71142a9e9dc53 100644 (file)
@@ -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)