]> git-server-git.apps.pok.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)
committerAdam King <adking@redhat.com>
Fri, 17 Feb 2023 15:37:58 +0000 (10:37 -0500)
Fixes: https://tracker.ceph.com/issues/58051
Signed-off-by: Mykola Golub <mykola.golub@clyso.com>
src/pybind/mgr/cephadm/serve.py

index 264dcfb2da4f5cfcb9105aee562b7def0123049b..59803804e667235f7cdf4d9eaaa058bec9432c5e 100644 (file)
@@ -1528,12 +1528,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'),