From 81f0ded253c0a03079a1eb9843fa09519695c0a8 Mon Sep 17 00:00:00 2001 From: Ping Qin Date: Tue, 14 Jan 2025 14:56:12 +0900 Subject: [PATCH] feat: Enhanced CephVersion parser to support more versions Signed-off-by: Ping Qin rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED --- insights/parsers/ceph_version.py | 32 ++++++++++++++++++++- insights/tests/parsers/test_ceph_version.py | 8 ++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/insights/parsers/ceph_version.py b/insights/parsers/ceph_version.py index 9b300d7f96..fa5c27a685 100644 --- a/insights/parsers/ceph_version.py +++ b/insights/parsers/ceph_version.py @@ -18,7 +18,7 @@ # TODO: the following metrics need update timely per: # - https://access.redhat.com/solutions/2045583 -# - https://access.redhat.com/articles/1372203 +# - https://access.redhat.com/support/policy/updates/ceph-storage community_to_release_map = { "0.80.8-5": {'version': "1.2.3", 'major': '1.2', 'minor': '3', 'downstream_release': 'NA'}, "0.94.1-15": {'version': "1.3", 'major': '1.3', 'minor': '0', 'downstream_release': 'NA'}, @@ -88,12 +88,42 @@ "14.2.11-199": {'version': "4.2.3", 'major': '4', 'minor': '2', 'downstream_release': '0'}, "14.2.11-208": {'version': "4.2.4", 'major': '4', 'minor': '2', 'downstream_release': '0'}, "14.2.22-110": {'version': "4.3", 'major': '4', 'minor': '3', 'downstream_release': '0'}, + "14.2.22-128": {'version': "4.3.1", 'major': '4', 'minor': '3', 'downstream_release': '1'}, "16.2.0-117": {'version': "5.0", 'major': '5', 'minor': '0', 'downstream_release': '0'}, "16.2.0-143": {'version': "5.0.1", 'major': '5', 'minor': '0', 'downstream_release': '0'}, "16.2.0-146": {'version': "5.0.3", 'major': '5', 'minor': '0', 'downstream_release': '0'}, "16.2.0-152": {'version': "5.0.4", 'major': '5', 'minor': '0', 'downstream_release': '0'}, "16.2.7-98": {'version': "5.1", 'major': '5', 'minor': '1', 'downstream_release': '0'}, "16.2.7-112": {'version': "5.1.1", 'major': '5', 'minor': '1', 'downstream_release': '0'}, + "16.2.7-126": {'version': "5.1.2", 'major': '5', 'minor': '1', 'downstream_release': '2'}, + "16.2.8-84": {'version': "5.2", 'major': '5', 'minor': '2', 'downstream_release': '0'}, + "16.2.8-85": {'version': "5.2", 'major': '5', 'minor': '2', 'downstream_release': 'async'}, + "16.2.10-94": {'version': "5.3", 'major': '5', 'minor': '3', 'downstream_release': '0'}, + "16.2.10-138": {'version': "5.3.1", 'major': '5', 'minor': '3', 'downstream_release': '1'}, + "16.2.10-160": {'version': "5.3.2", 'major': '5', 'minor': '3', 'downstream_release': '2'}, + "16.2.10-172": {'version': "5.3.3", 'major': '5', 'minor': '3', 'downstream_release': '3'}, + "16.2.10-187": {'version': "5.3.4", 'major': '5', 'minor': '3', 'downstream_release': '4'}, + "16.2.10-208": {'version': "5.3.5", 'major': '5', 'minor': '3', 'downstream_release': '5'}, + "16.2.10-248": {'version': "5.3.6", 'major': '5', 'minor': '3', 'downstream_release': '6'}, + "16.2.10-266": {'version': "5.3.7", 'major': '5', 'minor': '3', 'downstream_release': '7'}, + "17.2.5-75": {'version': "6.0", 'major': '6', 'minor': '0', 'downstream_release': '0'}, + "17.2.6-70": {'version': "6.1", 'major': '6', 'minor': '1', 'downstream_release': '0'}, + "17.2.6-100": {'version': "6.1.1", 'major': '6', 'minor': '1', 'downstream_release': '1'}, + "17.2.6-148": {'version': "6.1.2", 'major': '6', 'minor': '1', 'downstream_release': '2'}, + "17.2.6-167": {'version': "6.1.3", 'major': '6', 'minor': '1', 'downstream_release': '3'}, + "17.2.6-170": {'version': "6.1.3", 'major': '6', 'minor': '1', 'downstream_release': 'async'}, + "17.2.6-196": {'version': "6.1.4", 'major': '6', 'minor': '1', 'downstream_release': '4'}, + "17.2.6-209": {'version': "6.1.5", 'major': '6', 'minor': '1', 'downstream_release': '5'}, + "17.2.6-216": {'version': "6.1.6", 'major': '6', 'minor': '1', 'downstream_release': '6'}, + "17.2.6-246": {'version': "6.1.7", 'major': '6', 'minor': '1', 'downstream_release': '7'}, + "18.2.0-131": {'version': "7.0", 'major': '7', 'minor': '0', 'downstream_release': '0'}, + "18.2.0-153": {'version': "7.0.1", 'major': '7', 'minor': '0', 'downstream_release': '1'}, + "18.2.0-192": {'version': "7.0.2", 'major': '7', 'minor': '0', 'downstream_release': '2'}, + "18.2.1-194": {'version': "7.1", 'major': '7', 'minor': '1', 'downstream_release': '0'}, + "18.2.1-229": {'version': "7.1.1", 'major': '7', 'minor': '1', 'downstream_release': '1'}, + "18.2.1-262": {'version': "7.1.2", 'major': '7', 'minor': '1', 'downstream_release': '2'}, + "19.2.0-53": {'version': "8.0", 'major': '8', 'minor': '0', 'downstream_release': '0'}, + "19.2.0-55": {'version': "8.0.1", 'major': '8', 'minor': '0', 'downstream_release': '1'}, } diff --git a/insights/tests/parsers/test_ceph_version.py b/insights/tests/parsers/test_ceph_version.py index db2cf5c072..ec1e5048e6 100644 --- a/insights/tests/parsers/test_ceph_version.py +++ b/insights/tests/parsers/test_ceph_version.py @@ -17,6 +17,7 @@ CV10 = "ceph version 12.2.8-128.el7cp (030358773c5213a14c1444a5147258672b2dc15f)" CV10_1 = "ceph version 12.2.12-74.el7cp (030358773c5213a14c1444a5147258672b2dc15f)" CV_els = "ceph version 10.2.10-51.el7cp (030358773c5213a14c1444a5147258672b2dc15f)" +CV18 = "ceph version 18.2.1-229.el9cp (b83334e01379f267fb2f9ce729d74a0a8fa1e92c)" def test_ceph_version(): @@ -98,3 +99,10 @@ def test_ceph_version(): assert ceph_version_els.upstream_version['release'] == 10 assert ceph_version_els.upstream_version['major'] == 2 assert ceph_version_els.upstream_version['minor'] == 10 + + ceph_version18 = CephVersion(context_wrap(CV18)) + assert ceph_version18.version == "7.1.1" + assert ceph_version18.major == '7' + assert ceph_version18.minor == "1" + assert not ceph_version18.is_els + assert ceph_version18.downstream_release == "1"