Skip to content

Commit

Permalink
DAOS-16669 test: fix pool list ftest (#15373)
Browse files Browse the repository at this point in the history
Fix regression on pool/list_verbose.py functional test introduced with
DAOS-14419.

Signed-off-by: Cedric Koch-Hofer <[email protected]>
  • Loading branch information
knard-intel authored Oct 25, 2024
1 parent 78293a9 commit df3dd24
Showing 1 changed file with 22 additions and 11 deletions.
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

0 comments on commit df3dd24

Please sign in to comment.