scripts/nvmf_perf: don't rely on __del__ for destroying objects
As described in Python documentation: It is not guaranteed that __del__() methods are called for objects that still exist when the interpreter exits. Because of that class instance objects were not always destroyed after tests. Change-Id: I10f05a480cde37d274d6475efdf47d094cab7cb9 Signed-off-by: Karol Latecki <karol.latecki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11136 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
e7544273c9
commit
c995cc2803
@ -714,7 +714,7 @@ class Initiator(Server):
|
||||
def set_local_nic_info_helper(self):
|
||||
return json.loads(self.exec_cmd(["lshw", "-json"]))
|
||||
|
||||
def __del__(self):
|
||||
def stop(self):
|
||||
self.ssh_connection.close()
|
||||
|
||||
def exec_cmd(self, cmd, stderr_redirect=False, change_dir=None):
|
||||
@ -954,7 +954,7 @@ class KernelTarget(Target):
|
||||
if "nvmet_bin" in target_config:
|
||||
self.nvmet_bin = target_config["nvmet_bin"]
|
||||
|
||||
def __del__(self):
|
||||
def stop(self):
|
||||
nvmet_command(self.nvmet_bin, "clear")
|
||||
|
||||
def kernel_tgt_gen_subsystem_conf(self, nvme_list, address_list):
|
||||
@ -1220,7 +1220,7 @@ class SPDKTarget(Target):
|
||||
|
||||
self.spdk_tgt_configure()
|
||||
|
||||
def __del__(self):
|
||||
def stop(self):
|
||||
if self.bpf_proc:
|
||||
self.log_print("Stopping BPF Trace script")
|
||||
self.bpf_proc.terminate()
|
||||
@ -1252,9 +1252,6 @@ class KernelInitiator(Initiator):
|
||||
if "io_uring" in self.ioengine:
|
||||
self.extra_params = "--nr-poll-queues=8"
|
||||
|
||||
def __del__(self):
|
||||
self.ssh_connection.close()
|
||||
|
||||
def get_connected_nvme_list(self):
|
||||
json_obj = json.loads(self.exec_cmd(["sudo", "nvme", "list", "-o", "json"]))
|
||||
nvme_list = [os.path.basename(x["DevicePath"]) for x in json_obj["Devices"]
|
||||
@ -1466,6 +1463,9 @@ if __name__ == "__main__":
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
# TODO: This try block is definietly too large. Need to break this up into separate
|
||||
# logical blocks to reduce size.
|
||||
try:
|
||||
target_obj.tgt_start()
|
||||
|
||||
for i in initiators:
|
||||
@ -1540,3 +1540,10 @@ if __name__ == "__main__":
|
||||
i.restore_services()
|
||||
i.restore_sysctl()
|
||||
target_obj.parse_results(args.results, args.csv_filename)
|
||||
finally:
|
||||
for i in initiators:
|
||||
try:
|
||||
i.stop()
|
||||
except Exception as err:
|
||||
pass
|
||||
target_obj.stop()
|
||||
|
Loading…
Reference in New Issue
Block a user