Skip to content

Commit

Permalink
Merge pull request #10071 from vavuthu/fix_mon_count_testcases_arbiter
Browse files Browse the repository at this point in the history
change pdb max unavailable to 2 if we have at least 5 mons in a cluster
  • Loading branch information
vavuthu authored Jul 19, 2024
2 parents cac9e60 + cb1d807 commit ed75f13
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
13 changes: 7 additions & 6 deletions ocs_ci/ocs/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')}"
Expand Down
15 changes: 13 additions & 2 deletions tests/functional/z_cluster/upgrade/test_check_pdb_post_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit ed75f13

Please sign in to comment.