1
0
Fork 0

Adding upstream version 2.4.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-03-17 07:17:42 +01:00
parent b76282b820
commit 7422bc4c2f
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
35 changed files with 364 additions and 122 deletions

View file

@ -6,8 +6,8 @@
#
# Authors: Martin Belanger <Martin.Belanger@dell.com>
#
''' Module that provides a way to retrieve discovered
services from the Avahi daemon over D-Bus.
'''Module that provides a way to retrieve discovered
services from the Avahi daemon over D-Bus.
'''
import socket
import typing
@ -167,9 +167,11 @@ class Service: # pylint: disable=too-many-instance-attributes
'trsvcid': trsvcid,
# host-iface permitted for tcp alone and not rdma
'host-iface': host_iface,
'subsysnqn': txt.get('nqn', defs.WELL_KNOWN_DISC_NQN).strip()
if conf.NvmeOptions().discovery_supp
else defs.WELL_KNOWN_DISC_NQN,
'subsysnqn': (
txt.get('nqn', defs.WELL_KNOWN_DISC_NQN).strip()
if conf.NvmeOptions().discovery_supp
else defs.WELL_KNOWN_DISC_NQN
),
}
self._ip = iputil.get_ipaddress_obj(traddr, ipv4_mapped_convert=True)

View file

@ -289,8 +289,6 @@ class SvcConf(metaclass=singleton.Singleton): # pylint: disable=too-many-public
nr_write_queues = property(functools.partial(get_option, section='Global', option='nr-write-queues'))
reconnect_delay = property(functools.partial(get_option, section='Global', option='reconnect-delay'))
zeroconf_enabled = property(functools.partial(get_option, section='Service Discovery', option='zeroconf'))
zeroconf_persistence_sec = property(
functools.partial(
get_option, section='Discovery controller connection management', option='zeroconf-connections-persistence'
@ -307,6 +305,11 @@ class SvcConf(metaclass=singleton.Singleton): # pylint: disable=too-many-public
functools.partial(get_option, section='I/O controller connection management', option='connect-attempts-on-ncc')
)
@property # pylint chokes on this when defined as zeroconf_enabled=property(...). Works fine using a decorator...
def zeroconf_enabled(self):
'''Return whether zeroconf is enabled'''
return self.get_option(section='Service Discovery', option='zeroconf')
@property
def stypes(self):
'''@brief Get the DNS-SD/mDNS service types.'''
@ -338,6 +341,7 @@ class SvcConf(metaclass=singleton.Singleton): # pylint: disable=too-many-public
'host-traddr': [TRADDR],
'host-iface': [IFACE],
'host-nqn': [NQN],
'dhchap-secret': [KEY],
'dhchap-ctrl-secret': [KEY],
'hdr-digest': [BOOL]
'data-digest': [BOOL]
@ -707,7 +711,7 @@ class NvmeOptions(metaclass=singleton.Singleton):
# ******************************************************************************
class NbftConf(metaclass=singleton.Singleton):
class NbftConf(metaclass=singleton.Singleton): # pylint: disable=too-few-public-methods
'''Read and cache configuration file.'''
def __init__(self, root_dir=defs.NBFT_SYSFS_PATH):

View file

@ -221,23 +221,39 @@ class Controller(stas.ControllerABC): # pylint: disable=too-many-instance-attri
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.discovery_ctrl = self._discovery_ctrl
# Set the DHCHAP key on the controller
# NOTE that this will eventually have to
# Set the DHCHAP host key on the controller
# NOTE that this may eventually have to
# change once we have support for AVE (TP8019)
ctrl_dhchap_key = self.tid.cfg.get('dhchap-ctrl-secret')
if ctrl_dhchap_key and self._nvme_options.dhchap_ctrlkey_supp:
has_dhchap_key = hasattr(self._ctrl, 'dhchap_key')
if not has_dhchap_key:
# This is used for in-band authentication
dhchap_host_key = self.tid.cfg.get('dhchap-secret')
if dhchap_host_key and self._nvme_options.dhchap_hostkey_supp:
try:
self._ctrl.dhchap_host_key = dhchap_host_key
except AttributeError:
logging.warning(
'%s | %s - libnvme-%s does not allow setting the controller DHCHAP key. Please upgrade libnvme.',
'%s | %s - libnvme-%s does not allow setting the host DHCHAP key on the controller. Please upgrade libnvme.',
self.id,
self.device,
defs.LIBNVME_VERSION,
)
# Set the DHCHAP controller key on the controller
# NOTE that this may eventually have to
# change once we have support for AVE (TP8019)
# This is used for bidirectional authentication
dhchap_ctrl_key = self.tid.cfg.get('dhchap-ctrl-secret')
if dhchap_ctrl_key and self._nvme_options.dhchap_ctrlkey_supp:
try:
self._ctrl.dhchap_key = dhchap_ctrl_key
except AttributeError:
logging.warning(
'%s | %s - libnvme-%s does not allow setting the controller DHCHAP key on the controller. Please upgrade libnvme.',
self.id,
self.device,
defs.LIBNVME_VERSION,
)
else:
self._ctrl.dhchap_key = ctrl_dhchap_key
# Audit existing nvme devices. If we find a match, then
# we'll just borrow that device instead of creating a new one.

View file

@ -6,8 +6,7 @@
#
# Authors: Martin Belanger <Martin.Belanger@dell.com>
''' @brief This file gets automagically configured by meson at build time.
'''
'''@brief This file gets automagically configured by meson at build time.'''
import os
import sys
import shutil

View file

@ -123,7 +123,7 @@ class NameResolver: # pylint: disable=too-few-public-methods
The callback @callback will be called once all hostnames have
been resolved.
@param controllers: List of trid.TID
@param controllers_in: List of trid.TID
'''
pending_resolution_count = 0
controllers_out = []

View file

@ -510,7 +510,7 @@ class Stac(Service):
UDEV_RULE_OVERRIDE = r'''
ACTION=="change", SUBSYSTEM=="fc", ENV{FC_EVENT}=="nvmediscovery", \
ENV{NVMEFC_HOST_TRADDR}=="*", ENV{NVMEFC_TRADDR}=="*", \
RUN+="%s --no-block start nvmf-connect@--transport=fc\t--traddr=$env{NVMEFC_TRADDR}\t--trsvcid=none\t--host-traddr=$env{NVMEFC_HOST_TRADDR}.service"
RUN+="%s --no-block restart nvmf-connect@--device\x3dnone\x09--transport\x3dfc\x09--traddr\x3d$env{NVMEFC_TRADDR}\x09--trsvcid\x3dnone\x09--host-traddr\x3d$env{NVMEFC_HOST_TRADDR}.service"
'''
@ -809,11 +809,7 @@ class Staf(Service):
origin = (
'configured'
if tid in configured_ctrl_list
else 'referral'
if tid in referral_ctrl_list
else 'discovered'
if tid in discovered_ctrl_list
else None
else 'referral' if tid in referral_ctrl_list else 'discovered' if tid in discovered_ctrl_list else None
)
if origin is not None:
controller.origin = origin
@ -868,10 +864,12 @@ class Staf(Service):
return
# We need to invoke "nvme connect-all" using nvme-cli's nvmf-connect@.service
# NOTE: Eventually, we'll be able to drop --host-traddr and --host-iface from
# NOTE 1: Eventually, we'll be able to drop --host-traddr and --host-iface from
# the parameters passed to nvmf-connect@.service. A fix was added to connect-all
# to infer these two values from the device used to connect to the DC.
# Ref: https://github.com/linux-nvme/nvme-cli/pull/1812
#
# NOTE 2:--transport, --traddr, and --trsvcid, not needed when using --device
cnf = [
('--device', udev_obj.sys_name),
('--host-traddr', udev_obj.properties.get('NVME_HOST_TRADDR', None)),

View file

@ -33,6 +33,7 @@ class TID: # pylint: disable=too-many-instance-attributes
'host-nqn': str, # [optional]
# Connection parameters
'dhchap-secret': str, # [optional]
'dhchap-ctrl-secret': str, # [optional]
'hdr-digest': str, # [optional]
'data-digest': str, # [optional]

View file

@ -6,12 +6,12 @@
#
# Authors: Martin Belanger <Martin.Belanger@dell.com>
#
''' distutils (and hence LooseVersion) is being deprecated. None of the
suggested replacements (e.g. from pkg_resources import parse_version) quite
work with Linux kernel versions the way LooseVersion does.
'''distutils (and hence LooseVersion) is being deprecated. None of the
suggested replacements (e.g. from pkg_resources import parse_version) quite
work with Linux kernel versions the way LooseVersion does.
It was suggested to simply lift the LooseVersion code and vendor it in,
which is what this module is about.
It was suggested to simply lift the LooseVersion code and vendor it in,
which is what this module is about.
'''
import re