Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvme_gw_server: allow to change rpc socket address #4

Merged
merged 1 commit into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions nvme_gw.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ client_cert = ./client.crt

[spdk]

spdk_server_addr = /var/tmp/spdk.sock
spdk_port = 5260
rpc_socket = /var/tmp/spdk.sock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer this to be called spdk_socket

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it is stated in the commit log message, I don't see much sens to use spdk_ prefix for parameters in [spdk] section.

timeout = 60.0
log_level = ERROR
conn_retries = 3
11 changes: 5 additions & 6 deletions nvme_gw_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ def start_spdk(self):
self.spdk_rpc = spdk_rpc
spdk_tgt = self.nvme_config.get("config", "spdk_tgt")
spdk_cmd = os.path.join(spdk_path, spdk_tgt)
spdk_rpc_socket = self.nvme_config.get("spdk", "rpc_socket")

cmd = [spdk_cmd, "all", "-u"]
cmd = [spdk_cmd, "-u", "-r", spdk_rpc_socket]
self.logger.info(f"Starting {' '.join(cmd)}")

try:
Expand All @@ -48,20 +49,18 @@ def start_spdk(self):
self.logger.error(f"Unable to start SPDK: \n {ex}")
raise

spdk_server_addr = self.nvme_config.get("spdk", "spdk_server_addr")
spdk_port = self.nvme_config.get("spdk", "spdk_port")
timeout = self.nvme_config.getfloat("spdk", "timeout")
log_level = self.nvme_config.get("spdk", "log_level")
conn_retries = self.nvme_config.getint("spdk", "conn_retries")

self.logger.info(
f"Attempting to initialize SPDK: server_addr: {spdk_server_addr}, port: {spdk_port}, conn_retries: {conn_retries}, timeout: {timeout}"
f"Attempting to initialize SPDK: rpc_socket: {spdk_rpc_socket}, conn_retries: {conn_retries}, timeout: {timeout}"
)

try:
self.client = self.spdk_rpc.client.JSONRPCClient(
spdk_server_addr,
spdk_port,
spdk_rpc_socket,
None,
timeout,
log_level=log_level,
conn_retries=conn_retries,
Expand Down