Commit 93e056ba authored by Karol Latecki's avatar Karol Latecki Committed by Tomasz Zawadzki
Browse files

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: default avatarKarol Latecki <karol.latecki@intel.com>
Change-Id: I30699ca1d8541ff2f57ea609e5caf0304feb4282
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14740


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
parent 4e07343f
Loading
Loading
Loading
Loading
+1 −18
Original line number Diff line number Diff line
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")
+6 −3
Original line number Diff line number Diff line
@@ -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()