scripts/nvmf_perf: clean up common.py

Remove unused imports and unused function.
Move nvmet_command function to Kernel Target
as it's specific only to this class.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I30699ca1d8541ff2f57ea609e5caf0304feb4282
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14740
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-09-28 15:54:30 +02:00 committed by Tomasz Zawadzki
parent 4e07343fea
commit 93e056ba6c
2 changed files with 7 additions and 21 deletions

View File

@ -1,17 +1,4 @@
import os
import re
import json
from itertools import product, chain
from subprocess import check_output, CalledProcessError, Popen
def get_used_numa_nodes():
used_numa_nodes = set()
for bdf in get_nvme_devices_bdf():
with open("/sys/bus/pci/devices/%s/numa_node" % bdf, "r") as numa_file:
output = numa_file.read()
used_numa_nodes.add(int(output))
return used_numa_nodes
from subprocess import check_output
def get_nvme_devices_count():
@ -36,7 +23,3 @@ def get_nvme_devices():
output = [x for x in output.split("\n") if "nvme" in x]
print("Done getting kernel NVMe names")
return output
def nvmet_command(nvmet_bin, command):
return check_output("%s %s" % (nvmet_bin, command), shell=True).decode(encoding="utf-8")

View File

@ -1031,7 +1031,10 @@ class KernelTarget(Target):
self.nvmet_bin = target_config["nvmet_bin"]
def stop(self):
nvmet_command(self.nvmet_bin, "clear")
self.nvmet_command(self.nvmet_bin, "clear")
def nvmet_command(self, nvmet_bin, command):
return self.exec_cmd([nvmet_bin, *(command.split(" "))])
def kernel_tgt_gen_subsystem_conf(self, nvme_list):
@ -1098,8 +1101,8 @@ class KernelTarget(Target):
self.kernel_tgt_gen_subsystem_conf(nvme_list)
self.subsys_no = len(nvme_list)
nvmet_command(self.nvmet_bin, "clear")
nvmet_command(self.nvmet_bin, "restore kernel.conf")
self.nvmet_command(self.nvmet_bin, "clear")
self.nvmet_command(self.nvmet_bin, "restore kernel.conf")
if self.enable_adq:
self.adq_configure_tc()