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-15698 test: Update the reset faulty device logic for nvme_utils.… #15755

Open
wants to merge 1 commit into
base: release/2.6
Choose a base branch
from
Open
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
20 changes: 13 additions & 7 deletions src/tests/ftest/util/nvme_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
(C) Copyright 2020-2024 Intel Corporation.

Check failure on line 2 in src/tests/ftest/util/nvme_utils.py

View workflow job for this annotation

GitHub Actions / Copyright check

Copyright out of date

SPDX-License-Identifier: BSD-2-Clause-Patent
"""
Expand Down Expand Up @@ -44,32 +44,38 @@
Args:
test (Test): avocado test class
dmg (DmgCommand): a DmgCommand class instance
server (NodeSet): host on which to issue the dmg storage set nvme-faulty
server (NodeSet): host on which to issue the dmg storage set nvme-faulty. Must be one host.
uuid (str): the device UUID
pool (TestPool, optional): pool used to wait for rebuild to start/complete if specified.
Defaults to None.
has_sys_xs (bool, optional): the device's has_sys_xs property value. Defaults to False.
kwargs (dict, optional): named arguments to pass to the DmgCommand.storage_set_faulty.

Returns:
dict: the json response from the dmg storage set-faulty command.

dict: the json response from the dmg storage set-faulty command. None if has_sys_xs is True.
"""
kwargs['host'] = server
kwargs['uuid'] = uuid
response = None
try:
response = get_dmg_response(dmg.storage_set_faulty, **kwargs)
if has_sys_xs:
test.fail("Setting a sys_xs device faulty should fail.")
except CommandFailure as error:
if not has_sys_xs:
test.fail(str(error))

# Update the expected status of the any stopped/excluded ranks
if has_sys_xs:
ranks = [test.server_managers[-1].ranks[server]]
rank_to_host = test.server_managers[-1].ranks
ranks = []
for rank, host in rank_to_host.items():
if host == str(server):
ranks.append(rank)
test.server_managers[-1].update_expected_states(ranks, ["stopped", "excluded"])

# Add a tearDown method to reset the faulty device
test.register_cleanup(reset_fault_device, dmg=dmg, server=server, uuid=uuid)
else:
# Add a tearDown method to reset the faulty device
test.register_cleanup(reset_fault_device, dmg=dmg, server=server, uuid=uuid)

if pool:
# Wait for rebuild to start
Expand Down
Loading