scripts/nvmf_perf: move get_nvme_devices to Kernel Target

This function is used only by this class, remove it
from common module.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I6cb01e68f0005ddc1604ff4014c6b346da3a970e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14852
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
This commit is contained in:
Karol Latecki 2022-10-04 12:39:29 +02:00 committed by Tomasz Zawadzki
parent 3a359b7923
commit 0b995d4aba
2 changed files with 6 additions and 9 deletions

View File

@ -23,14 +23,6 @@ def get_nvme_devices_bdf():
return output
def get_nvme_devices():
print("Getting kernel NVMe names")
output = check_output("lsblk -o NAME -nlp", shell=True).decode(encoding="utf-8")
output = [x for x in output.split("\n") if "nvme" in x]
print("Done getting kernel NVMe names")
return output
def read_json_stats(file):
with open(file, "r") as json_data:
data = json.load(json_data)

View File

@ -862,6 +862,11 @@ class KernelTarget(Target):
def stop(self):
self.nvmet_command(self.nvmet_bin, "clear")
def get_nvme_devices(self):
output = self.exec_cmd(["lsblk", "-o", "NAME", "-nlpd"])
output = [x for x in output.split("\n") if "nvme" in x]
return output
def nvmet_command(self, nvmet_bin, command):
return self.exec_cmd([nvmet_bin, *(command.split(" "))])
@ -925,7 +930,7 @@ class KernelTarget(Target):
nvme_list = ["/dev/nullb{}".format(x) for x in range(self.null_block)]
else:
self.log.info("Configuring with NVMe drives.")
nvme_list = get_nvme_devices()
nvme_list = self.get_nvme_devices()
self.kernel_tgt_gen_subsystem_conf(nvme_list)
self.subsys_no = len(nvme_list)