Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change pdb max unavailable to 2 if we have at least 5 mons in a cluster #10071

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading