1
0
Fork 0

Adding upstream version 2.3.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:56:09 +01:00
parent 16151f03e6
commit 75324c05ff
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
9 changed files with 77 additions and 25 deletions

View file

@ -32,13 +32,13 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
# Login against a Docker registry except on PR # Login against a Docker registry except on PR
# https://github.com/docker/login-action # https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }} - name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: ${{ github.actor }} username: ${{ github.actor }}
@ -48,14 +48,14 @@ jobs:
# https://github.com/docker/metadata-action # https://github.com/docker/metadata-action
- name: Extract Docker metadata - name: Extract Docker metadata
id: meta id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR) # Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action # https://github.com/docker/build-push-action
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
with: with:
context: . context: .
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}

View file

@ -13,11 +13,13 @@ jobs:
if: ${{ !github.event.act }} # skip during local actions testing if: ${{ !github.event.act }} # skip during local actions testing
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Install requirements - name: Install requirements
# make sure nvme-cli installed (we need it for /etc/nvme/hostnqn and /etc/nvme/hostid) # make sure nvme-cli installed (we need it for /etc/nvme/hostnqn and /etc/nvme/hostid)
run: sudo apt-get install --yes --quiet nvme-cli run: |
sudo apt update
sudo apt-get install --yes --quiet nvme-cli
- name: Load Kernel drivers - name: Load Kernel drivers
run: sudo modprobe -v nvme-fabrics run: sudo modprobe -v nvme-fabrics

View file

@ -13,10 +13,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: "CHECKOUT: nvme-stas" - name: "CHECKOUT: nvme-stas"
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: "INSTALL: Overall dependencies" - name: "INSTALL: Overall dependencies"
run: | run: |
sudo apt update
sudo apt-get install --yes --quiet python3-pip cmake iproute2 sudo apt-get install --yes --quiet python3-pip cmake iproute2
sudo python3 -m pip install --upgrade pip sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install --upgrade wheel meson ninja sudo python3 -m pip install --upgrade wheel meson ninja

View file

@ -14,7 +14,7 @@ jobs:
if: ${{ !github.event.act }} # skip during local actions testing if: ${{ !github.event.act }} # skip during local actions testing
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: hadolint/hadolint-action@v3.1.0 - uses: hadolint/hadolint-action@v3.1.0
with: with:
recursive: true recursive: true
@ -30,7 +30,7 @@ jobs:
steps: steps:
- name: "CHECKOUT: nvme-stas" - name: "CHECKOUT: nvme-stas"
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4 uses: actions/setup-python@v4
@ -39,6 +39,7 @@ jobs:
- name: "INSTALL: additional packages" - name: "INSTALL: additional packages"
run: | run: |
sudo apt update
sudo apt-get install --yes --quiet python3-pip cmake libgirepository1.0-dev libsystemd-dev python3-systemd swig libjson-c-dev || true sudo apt-get install --yes --quiet python3-pip cmake libgirepository1.0-dev libsystemd-dev python3-systemd swig libjson-c-dev || true
sudo python3 -m pip install --upgrade pip wheel meson ninja sudo python3 -m pip install --upgrade pip wheel meson ninja
python3 -m pip install --upgrade dasbus pylint pyflakes PyGObject lxml pyudev python3 -m pip install --upgrade dasbus pylint pyflakes PyGObject lxml pyudev
@ -77,7 +78,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: "CHECKOUT: nvme-stas" - name: "CHECKOUT: nvme-stas"
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: "BLACK" - name: "BLACK"
uses: psf/black@stable uses: psf/black@stable

View file

@ -9,9 +9,6 @@
version: 2 version: 2
python:
system_packages: true
build: build:
os: ubuntu-22.04 os: ubuntu-22.04
tools: tools:

View file

@ -5,9 +5,10 @@
New features: New features:
- Support for nBFT (NVMe-oF Boot Table). - Support for nBFT (NVMe-oF Boot Table).
- The Avahi driver will now verify reachability of services discovered through mDNS to make sure all discovered IP addresses can be connected to. This avoids invoking the NVMe kernel driver with invalid IP addresses and getting error messages in the syslog. - The Avahi driver will now verify reachability of services discovered through mDNS to make sure all discovered IP addresses can be connected to. This avoids invoking the NVMe kernel driver with invalid IP addresses and getting error messages in the syslog. While testing this feature, we found that the CDC may advertise itself (using mDNS) before it is actually ready to receive connections from the host. If a host reacting to mDNS advertisements tries to connect to the CDC before the CDC is listening for connections, a "Connection refused" will happen and the host may conclude that the CDC is not reachable. For that reason the host will keep trying to connect in the background. Retries will initially happen at a face pace and gradually be done at a slower pace.
- The Avahi driver will now print an error message if the same IP address is found on multiple interfaces. This indicates a misconfiguration of the network. - The Avahi driver will now print an error message if the same IP address is found on multiple interfaces. This indicates a misconfiguration of the network.
- Simplify algorithm that determines if an existing connection (is sysfs) can be reused by stafd/stacd instead of creating a duplicate connection. - Simplify algorithm that determines if an existing connection (is sysfs) can be reused by stafd/stacd instead of creating a duplicate connection.
- Improve scalability. First, the algorithm that handles kernel events was reworked to handle events faster. Second, limit the amount of times that the netlink kernel interface is invoked. Instead invoke netlink once and cache & reuse the data for the whole duration of the scanning loop.
Bug fixes: Bug fixes:

View file

@ -9,7 +9,7 @@
project( project(
'nvme-stas', 'nvme-stas',
meson_version: '>= 0.53.0', meson_version: '>= 0.53.0',
version: '2.3-rc5', version: '2.3',
license: 'Apache-2.0', license: 'Apache-2.0',
default_options: [ default_options: [
'buildtype=release', 'buildtype=release',

View file

@ -71,6 +71,29 @@ def fmt_service_str(interface, protocol, name, stype, domain, flags): # pylint:
) )
class ValueRange:
'''Implement a range of values with ceiling. Once the ceiling has been
reached, then any further request for a new value will return the
ceiling (i.e last value).'''
def __init__(self, values: list):
self._values = values
self._index = 0
def get_next(self):
'''Get the next value (or last value if ceiling was reached)'''
value = self._values[self._index]
if self._index >= 0:
self._index += 1
if self._index >= len(self._values):
self._index = -1
return value
def reset(self):
'''Reset the range to start from the beginning'''
self._index = 0
# ****************************************************************************** # ******************************************************************************
class Service: # pylint: disable=too-many-instance-attributes class Service: # pylint: disable=too-many-instance-attributes
'''Object used to keep track of the services discovered from the avahi-daemon''' '''Object used to keep track of the services discovered from the avahi-daemon'''
@ -109,6 +132,11 @@ class Service: # pylint: disable=too-many-instance-attributes
self._interface_id, self._protocol_id, self._name, self._stype, self._domain, self._flags self._interface_id, self._protocol_id, self._name, self._stype, self._domain, self._flags
) )
self._connect_check_retry_tmo = ValueRange([2, 5, 10, 30, 60, 300, 600])
self._connect_check_retry_tmr = gutil.GTimer(
self._connect_check_retry_tmo.get_next(), self._on_connect_check_retry
)
self._ip = None self._ip = None
self._resolver = None self._resolver = None
self._data = {} self._data = {}
@ -151,8 +179,17 @@ class Service: # pylint: disable=too-many-instance-attributes
self._identified_cback() self._identified_cback()
return return
self._connect_check(verbose=True) # Enable verbosity on first attempt
def _connect_check(self, verbose=False):
self._reachable = False self._reachable = False
connect_checker = gutil.TcpChecker(traddr, trsvcid, host_iface, self._tcp_connect_check_cback) connect_checker = gutil.TcpChecker(
self._data['traddr'],
self._data['trsvcid'],
self._data['host-iface'],
verbose,
self._tcp_connect_check_cback,
)
try: try:
connect_checker.connect() connect_checker.connect()
@ -168,7 +205,16 @@ class Service: # pylint: disable=too-many-instance-attributes
self._connect_checker.close() self._connect_checker.close()
self._connect_checker = None self._connect_checker = None
self._reachable = connected self._reachable = connected
if self._reachable:
self._identified_cback() self._identified_cback()
else:
# Restart the timer but with incremented timeout
self._connect_check_retry_tmr.start(self._connect_check_retry_tmo.get_next())
def _on_connect_check_retry(self):
self._connect_check()
return GLib.SOURCE_REMOVE
def set_resolver(self, resolver): def set_resolver(self, resolver):
'''Set the resolver object''' '''Set the resolver object'''

View file

@ -423,7 +423,9 @@ class Deferred:
class TcpChecker: # pylint: disable=too-many-instance-attributes class TcpChecker: # pylint: disable=too-many-instance-attributes
'''@brief Verify that a TCP connection can be established with an enpoint''' '''@brief Verify that a TCP connection can be established with an enpoint'''
def __init__(self, traddr, trsvcid, host_iface, user_cback, *user_data): def __init__(
self, traddr, trsvcid, host_iface, verbose, user_cback, *user_data
): # pylint: disable=too-many-arguments
self._user_cback = user_cback self._user_cback = user_cback
self._host_iface = host_iface self._host_iface = host_iface
self._user_data = user_data self._user_data = user_data
@ -432,6 +434,7 @@ class TcpChecker: # pylint: disable=too-many-instance-attributes
self._cancellable = None self._cancellable = None
self._gio_sock = None self._gio_sock = None
self._native_sock = None self._native_sock = None
self._verbose = verbose
def connect(self): def connect(self):
'''Attempt to connect''' '''Attempt to connect'''
@ -502,6 +505,7 @@ class TcpChecker: # pylint: disable=too-many-instance-attributes
if err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.CANCELLED): if err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.CANCELLED):
logging.debug('TcpChecker._connect_async_cback() - %s', err.message) # pylint: disable=no-member logging.debug('TcpChecker._connect_async_cback() - %s', err.message) # pylint: disable=no-member
else: else:
if self._verbose:
logging.info( logging.info(
'Unable to verify TCP connectivity - (%-10s %-14s %s): %s', 'Unable to verify TCP connectivity - (%-10s %-14s %s): %s',
self._host_iface + ',', self._host_iface + ',',