From 5ad5fc65b0bc3f54df9d3ae8441732498e29141d Mon Sep 17 00:00:00 2001 From: Martin Belanger Date: Fri, 2 Dec 2022 11:10:39 -0500 Subject: [PATCH] Avahi: Allow uppercase/lowercase "NQN/nqn" key in TXT field Signed-off-by: Martin Belanger --- NEWS.md | 4 ++++ meson.build | 2 +- staslib/avahi.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index e121c63..7278b71 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # STorage Appliance Services (STAS) +## Changes with release 1.1.8 + +- Fix handling of TXT field containing NQN specified with lowercase "nqn" key. TP8009 says that the key for the Discovery Controller's NQN should be specified with the lowercase string "nqn". However, some DC may send an uppercase "NQN". nvme-stas will now support either uppercase "NQN" or lowercase "nqn". + ## Changes with release 1.1.7 - Trim white spaces from Discovery Log Pages Entries (DLPE) and Configuration parameters. diff --git a/meson.build b/meson.build index 40dc390..dc78e68 100644 --- a/meson.build +++ b/meson.build @@ -9,7 +9,7 @@ project( 'nvme-stas', meson_version: '>= 0.53.0', - version: '1.1.7', + version: '1.1.8', license: 'Apache-2.0', default_options: [ 'buildtype=release', diff --git a/staslib/avahi.py b/staslib/avahi.py index 809c6f5..4cb4bfc 100644 --- a/staslib/avahi.py +++ b/staslib/avahi.py @@ -30,7 +30,7 @@ def _txt2dict(txt: list): try: string = functools.reduce(lambda accumulator, c: accumulator + chr(c), list_of_chars, '') key, val = string.split("=") - the_dict[key] = val + the_dict[key.lower()] = val except Exception: # pylint: disable=broad-except pass @@ -412,7 +412,7 @@ def _service_identified( 'traddr': address.strip(), 'trsvcid': str(port).strip(), 'host-iface': socket.if_indextoname(interface).strip(), - 'subsysnqn': txt.get('NQN', defs.WELL_KNOWN_DISC_NQN).strip() + 'subsysnqn': txt.get('nqn', defs.WELL_KNOWN_DISC_NQN).strip() if conf.NvmeOptions().discovery_supp else defs.WELL_KNOWN_DISC_NQN, }