scripts/nvmf: move get_nvme_devices_count function

Getting number of nvme devices before check if this is
null_block test caused fails.

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I55b0399561ddb11b2f6c36408a56c525e813d239
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3497
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Maciej Wawryk 2020-07-23 12:54:34 +02:00 committed by Jim Harris
parent cb94476cfc
commit efd3f83d72

View File

@ -567,7 +567,6 @@ class KernelTarget(Target):
def tgt_start(self):
self.log_print("Configuring kernel NVMeOF Target")
self.subsys_no = get_nvme_devices_count()
if self.null_block:
print("Configuring with null block device.")
@ -579,6 +578,7 @@ class KernelTarget(Target):
self.kernel_tgt_gen_nullblock_conf(self.nic_ips[0])
else:
print("Configuring with NVMe drives.")
self.subsys_no = get_nvme_devices_count()
nvme_list = get_nvme_devices()
self.kernel_tgt_gen_subsystem_conf(nvme_list, self.nic_ips)
self.subsys_no = len(nvme_list)
@ -674,9 +674,10 @@ class SPDKTarget(Target):
rpc.client.print_dict(rpc.nvmf.nvmf_get_subsystems(self.client))
def tgt_start(self):
self.subsys_no = get_nvme_devices_count()
if self.null_block:
self.subsys_no = 1
else:
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")
command = " ".join([nvmf_app_path, "-m", self.num_cores])