From df3dd24c0b26f7b98415ba40047d54d8b5acaa20 Mon Sep 17 00:00:00 2001 From: Cedric Koch-Hofer <94527853+knard-intel@users.noreply.github.com> Date: Fri, 25 Oct 2024 14:49:50 +0200 Subject: [PATCH] DAOS-16669 test: fix pool list ftest (#15373) Fix regression on pool/list_verbose.py functional test introduced with DAOS-14419. Signed-off-by: Cedric Koch-Hofer --- src/tests/ftest/pool/list_verbose.py | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/tests/ftest/pool/list_verbose.py b/src/tests/ftest/pool/list_verbose.py index 68df5f876a4..370ca81ad40 100644 --- a/src/tests/ftest/pool/list_verbose.py +++ b/src/tests/ftest/pool/list_verbose.py @@ -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. @@ -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. @@ -61,7 +63,7 @@ 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, @@ -69,6 +71,7 @@ def create_expected(self, pool, scm_free, nvme_free, scm_imbalance, "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, @@ -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 @@ -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 @@ -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")) @@ -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") @@ -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 @@ -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: @@ -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. @@ -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) @@ -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(