From 4cf101fa4cdd253ecdc91acd2a1e2d17e2f16b35 Mon Sep 17 00:00:00 2001 From: vavuthu Date: Wed, 10 Jul 2024 19:17:13 +0530 Subject: [PATCH 1/2] change pdb max unavailable to 2 if we have at least 5 mons in a cluster Signed-off-by: vavuthu --- .../upgrade/test_check_pdb_post_upgrade.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/functional/z_cluster/upgrade/test_check_pdb_post_upgrade.py b/tests/functional/z_cluster/upgrade/test_check_pdb_post_upgrade.py index 66b672d77d7..7e10c84879b 100644 --- a/tests/functional/z_cluster/upgrade/test_check_pdb_post_upgrade.py +++ b/tests/functional/z_cluster/upgrade/test_check_pdb_post_upgrade.py @@ -46,13 +46,24 @@ def test_check_mon_pdb_post_upgrade(self): mons_after_upgrade = ceph_obj.get_mons_from_cluster() log.info(f"Mons after upgrade {mons_after_upgrade}") + if len(mons_after_upgrade) >= 5: + # pdb max unavailable is changed to 2 if we have at least 5 mons in a cluster + # https://bugzilla.redhat.com/show_bug.cgi?id=2264553 + expected_max_unavailable_mon = 2 + expected_disruptions_allowed = 2 + else: + expected_max_unavailable_mon = 1 + expected_disruptions_allowed = 1 + disruptions_allowed, min_available_mon, max_unavailable_mon = get_mon_pdb() log.info(f"Number of Mons Disruptions_allowed {disruptions_allowed}") log.info(f"Minimum_available mon count {min_available_mon}") log.info(f"Maximum_available mon count {max_unavailable_mon}") # The PDB values are considered from OCS 4.5 onwards. - assert disruptions_allowed == 1, "Mon Disruptions_allowed count not matching" + assert ( + disruptions_allowed == expected_disruptions_allowed + ), "Mon Disruptions_allowed count not matching" ocs_version = config.ENV_DATA["ocs_version"] if Version.coerce(ocs_version) < Version.coerce("4.6"): assert min_available_mon == 2, "Minimum available mon count is not matching" @@ -61,7 +72,7 @@ def test_check_mon_pdb_post_upgrade(self): # (https://bugzilla.redhat.com/show_bug.cgi?id=1946573) # (https://bugzilla.redhat.com/show_bug.cgi?id=1935065) assert ( - max_unavailable_mon == 1 + max_unavailable_mon == expected_max_unavailable_mon ), "Maximum unavailable mon count is not matching" @post_ocs_upgrade From cb1d807679d2dd6c22da195eb44e5720f8182a5e Mon Sep 17 00:00:00 2001 From: vavuthu Date: Wed, 10 Jul 2024 19:18:52 +0530 Subject: [PATCH 2/2] fix unsupported operand type and chnage the logic for fetching OSD PDBs Signed-off-by: vavuthu --- ocs_ci/ocs/cluster.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ocs_ci/ocs/cluster.py b/ocs_ci/ocs/cluster.py index 52f6d34ad74..4c44e338d6a 100644 --- a/ocs_ci/ocs/cluster.py +++ b/ocs_ci/ocs/cluster.py @@ -2176,18 +2176,19 @@ def validate_existence_of_blocking_pdb(): pdb_obj_get = pdb_obj.get() osd_pdb = [] for pdb in pdb_obj_get.get("items"): - if not any( - osd in pdb["metadata"]["name"] - for osd in [constants.MDS_PDB, constants.MON_PDB] - ): + # blocking OSD PDBs are in the format of rook-ceph-osd-zone-data-1 + if constants.OSD_PDB in pdb["metadata"]["name"]: osd_pdb.append(pdb) blocking_pdb_exist = False for osd in range(len(osd_pdb)): allowed_disruptions = osd_pdb[osd].get("status").get("disruptionsAllowed") maximum_unavailable = osd_pdb[osd].get("spec").get("maxUnavailable") - if allowed_disruptions & maximum_unavailable != 1: - logger.info("Blocking PDBs are created") + if allowed_disruptions & (maximum_unavailable != 1): + logger.info( + f"Blocking PDB {osd_pdb[osd].get('metadata').get('name')} are created" + ) blocking_pdb_exist = True + return blocking_pdb_exist else: logger.info( f"No blocking PDBs created, OSD PDB is {osd_pdb[osd].get('metadata').get('name')}"