From: Mykola Golub Date: Sun, 20 Nov 2022 13:11:11 +0000 (+0000) Subject: mgr/cephadm: try to avoid pull when getting container image info X-Git-Tag: v17.2.6~7^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a17bced0c481bb334fd660399aebc56a34d89c8f;p=ceph.git mgr/cephadm: try to avoid pull when getting container image info Fixes: https://tracker.ceph.com/issues/58051 Signed-off-by: Mykola Golub (cherry picked from commit ac882006e8bca484ad5dfe93e7374ffec07ef919) --- diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 646a173eef88..1864c9c592ff 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -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'),