]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: try to avoid pull when getting container image info
authorMykola Golub <mykola.golub@clyso.com>
Sun, 20 Nov 2022 13:11:11 +0000 (13:11 +0000)
committerMykola Golub <mykola.golub@clyso.com>
Tue, 7 Mar 2023 19:40:20 +0000 (21:40 +0200)
Fixes: https://tracker.ceph.com/issues/58051
Signed-off-by: Mykola Golub <mykola.golub@clyso.com>
(cherry picked from commit ac882006e8bca484ad5dfe93e7374ffec07ef919)

src/pybind/mgr/cephadm/serve.py

index 646a173eef885595650120021754077229051715..1864c9c592ffabaa9133e7d0b4513692a3c2be17 100644 (file)
@@ -1460,12 +1460,21 @@ class CephadmServe:
         if self.mgr.cache.host_needs_registry_login(host) and self.mgr.registry_url:
             await self._registry_login(host, json.loads(str(self.mgr.get_store('registry_credentials'))))
 
-        pullargs: List[str] = []
-        if self.mgr.registry_insecure:
-            pullargs.append("--insecure")
-
-        j = await self._run_cephadm_json(host, '', 'pull', pullargs, image=image_name, no_fsid=True)
-
+        j = None
+        try:
+            j = await self._run_cephadm_json(host, '', 'inspect-image', [],
+                                             image=image_name, no_fsid=True,
+                                             error_ok=True)
+        except OrchestratorError:
+            pass
+
+        if not j:
+            pullargs: List[str] = []
+            if self.mgr.registry_insecure:
+                pullargs.append("--insecure")
+
+            j = await self._run_cephadm_json(host, '', 'pull', pullargs,
+                                             image=image_name, no_fsid=True)
         r = ContainerInspectInfo(
             j['image_id'],
             j.get('ceph_version'),