Skip to content

Commit

Permalink
Fixing controller and namespace accessing issue in nvme.py
Browse files Browse the repository at this point in the history
In few places the nvme controller and namespaces access are slightly different.
So made them correct to get the right output.

Signed-off-by: Naresh Bannoth <[email protected]>
  • Loading branch information
Naresh-ibm committed Dec 30, 2024
1 parent 56b8eec commit 529e70f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions avocado/utils/nvme.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ def get_block_size(controller_name):
namespaces = get_current_ns_list(controller_name)
if namespaces:
namespace = namespaces[0]
cmd = f"nvme id-ns /dev/{namespace}"
cmd = f"nvme id-ns {namespace}"
out = process.run(cmd, shell=True, ignore_status=True).stdout_text
for line in str(out.splitlines):
for line in out.splitlines():
if "in use" in line:
return pow(2, int(line.split()[4].split(":")[-1]))
return 4096
Expand Down Expand Up @@ -211,7 +211,7 @@ def ns_rescan(controller_name):
:param controller_name: controller name on which re-scan is applied
"""
cmd = f"nvme ns-rescan {controller_name}"
cmd = f"nvme ns-rescan /dev/{controller_name}"
try:
process.run(cmd, shell=True, ignore_status=True)
except process.CmdError as detail:
Expand Down

0 comments on commit 529e70f

Please sign in to comment.