def tgt_start(self): 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") proc = subprocess.Popen( [nvmf_app_path, "--wait-for-rpc", "-m", self.num_cores]) self.pid = os.path.join(self.spdk_dir, "nvmf.pid") with open(self.pid, "w") as fh: fh.write(str(proc.pid)) self.nvmf_proc = proc self.log_print("SPDK NVMeOF Target PID=%s" % self.pid) self.log_print("Waiting for spdk to initilize...") while True: if os.path.exists("/var/tmp/spdk.sock"): break time.sleep(1) self.client = rpc.client.JSONRPCClient("/var/tmp/spdk.sock") if self.enable_zcopy: rpc.sock.sock_impl_set_options(self.client, impl_name="posix", enable_zerocopy_send=True) self.log_print("Target socket options:") rpc.client.print_dict( rpc.sock.sock_impl_get_options(self.client, impl_name="posix")) rpc.app.framework_set_scheduler(self.client, name=self.scheduler_name) rpc.framework_start_init(self.client) self.spdk_tgt_configure()
def ui_command_framework_start_init(self): if rpc.framework_start_init(self.client): self.is_init = True self.refresh()