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

DAOS-16669 test: fix pool list ftest #15373

Merged
merged 4 commits into from
Oct 25, 2024
Merged
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
33 changes: 22 additions & 11 deletions src/tests/ftest/pool/list_verbose.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class ListVerboseTest(IorTestBase):

def create_expected(self, pool, scm_free, nvme_free, scm_imbalance,
nvme_imbalance, targets_disabled=0, scm_size=None,
nvme_size=None, state=None, rebuild_state=None):
nvme_size=None, state=None, rebuild_state=None,
ranks_disabled=None):
# pylint: disable=too-many-arguments
"""Create expected dmg pool list output to compare against the actual.

Expand All @@ -39,6 +40,7 @@ def create_expected(self, pool, scm_free, nvme_free, scm_imbalance,
nvme_size (int, optional): NVMe size to fill in the output. Defaults to None.
state (str, optional): Expected pool state. Defaults to None.
rebuild_state (str, optional): Expected pool rebuild state. Defaults to None.
ranks_disabled (list, optional): List of disabled ranks. Defaults to None.

Returns:
dict: Expected in the same format of actual.
Expand All @@ -61,14 +63,15 @@ def create_expected(self, pool, scm_free, nvme_free, scm_imbalance,
upgrade_layout_ver = p_query["response"]["upgrade_layout_ver"]

return {
"query_mask": "rebuild,space",
"query_mask": "disabled_engines,rebuild,space",
"state": state,
"uuid": pool.uuid.lower(),
"label": pool.label.value,
"total_targets": targets_total,
"active_targets": targets_total - targets_disabled,
"total_engines": rank_count,
"disabled_targets": targets_disabled,
"disabled_ranks": ranks_disabled if ranks_disabled else [],
"svc_ldr": pool.svc_leader,
"svc_reps": pool.svc_ranks,
"upgrade_layout_ver": upgrade_layout_ver,
Expand Down Expand Up @@ -171,7 +174,8 @@ def verify_scm_size(self, actual, created, rank_count):
threshold, diff)
self.assertTrue(diff < threshold, msg)

def verify_pool_lists(self, targets_disabled, scm_size, nvme_size, state, rebuild_state):
def verify_pool_lists(self, targets_disabled, scm_size, nvme_size, state, rebuild_state,
ranks_disabled):
"""Call dmg pool list and verify.

self.pool should be a list. The elements of the inputs should
Expand All @@ -183,6 +187,7 @@ def verify_pool_lists(self, targets_disabled, scm_size, nvme_size, state, rebuil
nvme_size (list): List of NVMe size for pools.
state (list): List of pool state for pools.
rebuild_state (list): List of pool rebuild state for pools.
ranks_disabled (list): List of disabled ranks for pools.

Returns:
list: a list of dictionaries containing information for each pool from the dmg
Expand Down Expand Up @@ -228,7 +233,8 @@ def verify_pool_lists(self, targets_disabled, scm_size, nvme_size, state, rebuil
scm_size=pool_free_data["scm_size"],
nvme_size=nvme_size[index],
state=state[index],
rebuild_state=rebuild_state[index]))
rebuild_state=rebuild_state[index],
ranks_disabled=ranks_disabled[index]))

# Sort pools by UUID.
actual_pools.sort(key=lambda item: item.get("uuid"))
Expand Down Expand Up @@ -294,9 +300,10 @@ def test_fields_basic(self):
nvme_size = [None]
state = ["Ready"]
rebuild_state = ["idle"]
ranks_disabled = [[]]
self.verify_pool_lists(
targets_disabled=targets_disabled, scm_size=scm_size, nvme_size=nvme_size,
state=state, rebuild_state=rebuild_state)
state=state, rebuild_state=rebuild_state, ranks_disabled=ranks_disabled)

# 3. Create second pool.
self.log_step("Create second pool")
Expand All @@ -310,13 +317,15 @@ def test_fields_basic(self):
nvme_size.append(None)
state.append("Ready")
rebuild_state.append("idle")
ranks_disabled.append([])
self.verify_pool_lists(
targets_disabled=targets_disabled, scm_size=scm_size, nvme_size=nvme_size,
state=state, rebuild_state=rebuild_state)
state=state, rebuild_state=rebuild_state, ranks_disabled=ranks_disabled)

# 5. Exclude target 7 in rank 1 of pool 1.
self.log_step("Exclude target 7 in rank 1 of pool 1")
self.pool[0].exclude(ranks=[1], tgt_idx="7")
ranks_disabled[0].append(1)
self.pool[0].exclude(ranks=ranks_disabled[0], tgt_idx="7")

# Sizes are reduced by 1/8.
reduced_scm_size = self.pool[0].scm_size.value * 0.875
Expand All @@ -332,7 +341,7 @@ def test_fields_basic(self):

self.verify_pool_lists(
targets_disabled=targets_disabled, scm_size=scm_size, nvme_size=nvme_size,
state=state, rebuild_state=rebuild_state)
state=state, rebuild_state=rebuild_state, ranks_disabled=ranks_disabled)

# 7-11. Destroy and verify until the pools are gone.
while self.pool:
Expand All @@ -344,10 +353,11 @@ def test_fields_basic(self):
targets_disabled.pop()
scm_size.pop()
nvme_size.pop()
ranks_disabled.pop()

self.verify_pool_lists(
targets_disabled=targets_disabled, scm_size=scm_size, nvme_size=nvme_size,
state=state, rebuild_state=rebuild_state)
state=state, rebuild_state=rebuild_state, ranks_disabled=ranks_disabled)

def verify_used_imbalance(self, storage):
"""Verification steps for test_used_imbalance.
Expand All @@ -374,9 +384,10 @@ def verify_used_imbalance(self, storage):
scm_size = [None]
state = ["Ready"]
rebuild_state = ["idle"]
ranks_disabled = [[]]
actual_pools_before = self.verify_pool_lists(
targets_disabled=targets_disabled, scm_size=scm_size, nvme_size=nvme_size,
state=state, rebuild_state=rebuild_state)
state=state, rebuild_state=rebuild_state, ranks_disabled=ranks_disabled)

# 3. Store free.
free_before, _ = self.get_free_imbalance(actual_pools_before[0], storage)
Expand All @@ -394,7 +405,7 @@ def verify_used_imbalance(self, storage):
# obtained from actual.
actual_pools_after = self.verify_pool_lists(
targets_disabled=targets_disabled, scm_size=scm_size, nvme_size=nvme_size,
state=state, rebuild_state=rebuild_state)
state=state, rebuild_state=rebuild_state, ranks_disabled=ranks_disabled)

# Obtain the new free and imbalance.
free_after, imbalance_after = self.get_free_imbalance(
Expand Down
Loading