scripts/nvmf_perf: rename SPDK Target num_cores to core_mask
num_cores name was misleading, as the parameter actually contained core mask (or core list). Create separate class attributes with core mask and number of cores. Signed-off-by: Karol Latecki <karol.latecki@intel.com> Change-Id: Ibfae7770aea2f2c1c720abf567400deb50028ab4 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6535 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: Maciej Wawryk <maciejx.wawryk@intel.com>
This commit is contained in:
parent
128df53566
commit
4b3a60daee
@ -43,7 +43,7 @@ If set to 1, can be used for latency measurements as described in Test Case 3 of
|
||||
Integer. Enable data protection on created null block device. Defaults to 0 if option
|
||||
not present in JSON configuration file. See doc/jsonrpc.md "bdev_null_create" for details.
|
||||
|
||||
### num_cores
|
||||
### core_mask
|
||||
|
||||
List of CPU cores to assign for running SPDK NVMe-OF Target process. Can specify exact core numbers or ranges, eg:
|
||||
[0, 1, 10-15].
|
||||
|
@ -928,7 +928,8 @@ class SPDKTarget(Target):
|
||||
super(SPDKTarget, self).__init__(name, general_config, target_config)
|
||||
|
||||
# Required fields
|
||||
self.num_cores = target_config["num_cores"]
|
||||
self.core_mask = target_config["core_mask"]
|
||||
self.num_cores = self.get_num_cores(self.core_mask)
|
||||
|
||||
# Defaults
|
||||
self.dif_insert_strip = False
|
||||
@ -942,6 +943,21 @@ class SPDKTarget(Target):
|
||||
if "dif_insert_strip" in target_config:
|
||||
self.dif_insert_strip = target_config["dif_insert_strip"]
|
||||
|
||||
def get_num_cores(self, core_mask):
|
||||
if "0x" in core_mask:
|
||||
return bin(int(core_mask, 16)).count("1")
|
||||
else:
|
||||
num_cores = 0
|
||||
core_mask = core_mask.replace("[", "")
|
||||
core_mask = core_mask.replace("]", "")
|
||||
for i in core_mask.split(","):
|
||||
if "-" in i:
|
||||
x, y = i.split("-")
|
||||
num_cores += len(range(int(x), int(y))) + 1
|
||||
else:
|
||||
num_cores += 1
|
||||
return num_cores
|
||||
|
||||
def spdk_tgt_configure(self):
|
||||
self.log_print("Configuring SPDK NVMeOF target via RPC")
|
||||
numa_list = get_used_numa_nodes()
|
||||
@ -1036,7 +1052,7 @@ class SPDKTarget(Target):
|
||||
self.subsys_no = get_nvme_devices_count()
|
||||
self.log_print("Starting SPDK NVMeOF Target process")
|
||||
nvmf_app_path = os.path.join(self.spdk_dir, "build/bin/nvmf_tgt")
|
||||
proc = subprocess.Popen([nvmf_app_path, "--wait-for-rpc", "-m", str(self.num_cores)])
|
||||
proc = subprocess.Popen([nvmf_app_path, "--wait-for-rpc", "-m", self.core_mask])
|
||||
self.pid = os.path.join(self.spdk_dir, "nvmf.pid")
|
||||
|
||||
with open(self.pid, "w") as fh:
|
||||
|
Loading…
Reference in New Issue
Block a user