Skip to content

Commit

Permalink
Do not call persistent_set() from libnvme
Browse files Browse the repository at this point in the history
The persistent_set() API from libnvme had absolutely no effect on
connections. Most importantly, it did not set a default KATO on
persistent DC connections.

I/O connections, on the other hand, are assigned a default 2-minute
KATO by the kernel regardless of the persistent_set() function.

Signed-off-by: Martin Belanger <[email protected]>
  • Loading branch information
Martin Belanger committed Mar 28, 2022
1 parent a708be9 commit 2e76a8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions etc/stas/stafd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@

# kato: Keep Alive Timeout (KATO): This field specifies the timeout value
# for the Keep Alive feature in seconds. The default value for this
# field is 120 seconds (2 minutes).
# field is 30 seconds.
# Type: Unsigned integer
# Range: 0..N
# Unit: Seconds
#kato=120
#kato=30

# persistent-connections: Whether connections to Discovery Controllers (DC)
# are persistent. If stafd is stopped, the connections
Expand Down
13 changes: 12 additions & 1 deletion staslib/stas.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from libnvme import nvme
from staslib import defs

DC_KATO_DEFAULT = 30 # seconds

#*******************************************************************************
def check_if_allowed_to_continue():
''' @brief Let's perform some basic checks before going too far. There are
Expand Down Expand Up @@ -1160,7 +1162,6 @@ def _try_to_connect(self):
host_traddr=self.tid.host_traddr if self.tid.host_traddr else None,
host_iface=host_iface)
self._ctrl.discovery_ctrl_set(self._discovery_ctrl)
self._ctrl.persistent_set(True)

# Audit existing nvme devices. If we find a match, then
# we'll just borrow that device instead of creating a new one.
Expand All @@ -1177,6 +1178,16 @@ def _try_to_connect(self):
'data_digest': CNF.data_digest }
if CNF.kato is not None:
cfg['keep_alive_tmo'] = CNF.kato
elif self._discovery_ctrl:
# All the connections to Controllers (I/O and Discovery) are
# persistent. Persistent connections MUST configure the KATO.
# The kernel already assigns a default 2-minute KATO to I/O
# controller connections, but it doesn't assign one to
# Discovery controller (DC) connections. Here we set the default
# DC connection KATO to match the default set by nvme-cli on
# persistent DC connections (i.e. 30 sec).
cfg['keep_alive_tmo'] = DC_KATO_DEFAULT

LOG.debug('Controller._try_to_connect() - %s Connecting to nvme control with cfg=%s', self.id, cfg)
self._connect_op = AsyncOperationWithRetry(self._on_connect_success, self._on_connect_fail,
self._ctrl.connect, self._host, cfg)
Expand Down

0 comments on commit 2e76a8e

Please sign in to comment.