@@ -66,7 +66,8 @@ def _to_int(text):
6666
6767
6868def _to_bool (text , positive = 'true' ):
69- return _parse_single_val (text ).lower () == positive
69+ val = _parse_single_val (text )
70+ return val is not None and val .lower () == positive
7071
7172
7273def _to_ncc (text ):
@@ -77,7 +78,7 @@ def _to_ncc(text):
7778
7879
7980def _to_ip_family (text ):
80- return tuple ((4 if text == 'ipv4' else 6 for text in _parse_single_val (text ).split ('+' )))
81+ return tuple ((4 if token == 'ipv4' else 6 for token in _parse_single_val (text ).split ('+' )))
8182
8283
8384# ******************************************************************************
@@ -86,6 +87,11 @@ class OrderedMultisetDict(dict):
8687 and allow multiple configuration parameters with the same key. The
8788 result is a list of values, where values are sorted by the order they
8889 appear in the file.
90+
91+ Note: configparser internally joins repeated keys with '\\ n' when
92+ strict=False. __getitem__ splits on '\\ n' to reconstruct the list, so
93+ callers always receive a list of strings rather than a single newline-
94+ joined string.
8995 '''
9096
9197 def __setitem__ (self , key , value ):
@@ -214,12 +220,6 @@ class SvcConf(metaclass=singleton.Singleton):
214220 'convert' : _parse_list ,
215221 'default' : [],
216222 },
217- ### BEGIN: LEGACY SECTION TO BE REMOVED ###
218- 'blacklist' : {
219- 'convert' : _parse_list ,
220- 'default' : [],
221- },
222- ### END: LEGACY SECTION TO BE REMOVED ###
223223 },
224224 }
225225
@@ -316,6 +316,10 @@ def persistent_connections(self):
316316 section = 'Discovery controller connection management'
317317 option = 'persistent-connections'
318318
319+ # Use ignore_default=True so we can distinguish "not set in file" from
320+ # "set to false". The per-daemon default (stafd vs stacd) differs and is
321+ # held in self._defaults rather than in OPTION_CHECKER, so we fall back
322+ # to that dict explicitly.
319323 value = self .get_option (section , option , ignore_default = True )
320324 if value is not None :
321325 return value
@@ -379,11 +383,6 @@ def get_excluded(self):
379383 }
380384 '''
381385 controller_list = self .get_option ('Controllers' , 'exclude' )
382-
383- # 2022-09-20: Look for "blacklist". This is for backwards compatibility
384- # with releases 1.0 to 1.1.x. This is to be phased out (i.e. remove by 2024)
385- controller_list += self .get_option ('Controllers' , 'blacklist' )
386-
387386 excluded = [_parse_controller (controller ) for controller in controller_list ]
388387 for controller in excluded :
389388 controller .pop ('host-traddr' , None ) # remove host-traddr
@@ -544,8 +543,11 @@ def hostnqn(self):
544543 except FileNotFoundError as ex :
545544 sys .exit (f'Error reading mandatory Host NQN (see stasadm --help): { ex } ' )
546545
547- if value is not None and not value .startswith ('nqn.' ):
548- sys .exit (f'Error Host NQN "{ value } " should start with "nqn."' )
546+ if value is not None :
547+ if not value .startswith ('nqn.' ):
548+ sys .exit (f'Error Host NQN "{ value } " should start with "nqn."' )
549+ if len (value ) > 223 :
550+ sys .exit (f'Error Host NQN is too long ({ len (value )} chars, max 223 per NVMe spec)' )
549551
550552 return value
551553
0 commit comments