From: Sage Weil Date: Mon, 25 Jan 2021 22:46:43 +0000 (-0600) Subject: mgr/cephadm: only save version portion of version string X-Git-Tag: v16.2.0~207^2~18 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=78703dda2e01f03e28ec48b4009c01e14b3da654;p=ceph.git mgr/cephadm: only save version portion of version string We don't want to 'ceph version ' prefix or sha1 suffix. This matches us up with 'orch upgrade start' Signed-off-by: Sage Weil (cherry picked from commit dcaf514bbf1ac19c0ea9f5bfa724bca76ff2d126) --- diff --git a/src/pybind/mgr/cephadm/tests/test_upgrade.py b/src/pybind/mgr/cephadm/tests/test_upgrade.py index caf47aef97e51..3815253409811 100644 --- a/src/pybind/mgr/cephadm/tests/test_upgrade.py +++ b/src/pybind/mgr/cephadm/tests/test_upgrade.py @@ -57,7 +57,7 @@ def test_upgrade_run(use_repo_digest, cephadm_module: CephadmOrchestrator): def _versions_mock(cmd): return json.dumps({ 'mgr': { - 'myversion': 1 + 'ceph version 1.2.3 (asdf) blah': 1 } }) diff --git a/src/pybind/mgr/cephadm/upgrade.py b/src/pybind/mgr/cephadm/upgrade.py index d3f4f16567771..181b0ff23e75c 100644 --- a/src/pybind/mgr/cephadm/upgrade.py +++ b/src/pybind/mgr/cephadm/upgrade.py @@ -295,7 +295,8 @@ class CephadmUpgrade: }) return self.upgrade_state.target_id = target_id - self.upgrade_state.target_version = target_version + # extract the version portion of 'ceph version {version} ({sha1})' + self.upgrade_state.target_version = target_version.split(' ')[2] self.upgrade_state.repo_digest = repo_digest self._save_upgrade_state() target_image = self.target_image @@ -418,10 +419,11 @@ class CephadmUpgrade: }) j = json.loads(out_ver) for version, count in j.get(daemon_type, {}).items(): - if version != target_version: + short_version = version.split(' ')[2] + if short_version != target_version: logger.warning( 'Upgrade: %d %s daemon(s) are %s != target %s' % - (count, daemon_type, version, target_version)) + (count, daemon_type, short_version, target_version)) # push down configs if image_settings.get(daemon_type) != target_image: