summaryrefslogtreecommitdiffstats
path: root/staslib/gutil.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-25 08:22:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-25 08:22:07 +0000
commit73334e48e395cd0ac4fbef0611609a3bd70abfe2 (patch)
tree8881d2482e8a19e3c40e148571851d75a7bb2a9b /staslib/gutil.py
parentAdding upstream version 2.3~rc5. (diff)
downloadnvme-stas-73334e48e395cd0ac4fbef0611609a3bd70abfe2.tar.xz
nvme-stas-73334e48e395cd0ac4fbef0611609a3bd70abfe2.zip
Adding upstream version 2.3.upstream/2.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--staslib/gutil.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/staslib/gutil.py b/staslib/gutil.py
index 9aef347..7bdc117 100644
--- a/staslib/gutil.py
+++ b/staslib/gutil.py
@@ -423,7 +423,9 @@ class Deferred:
class TcpChecker: # pylint: disable=too-many-instance-attributes
'''@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._host_iface = host_iface
self._user_data = user_data
@@ -432,6 +434,7 @@ class TcpChecker: # pylint: disable=too-many-instance-attributes
self._cancellable = None
self._gio_sock = None
self._native_sock = None
+ self._verbose = verbose
def connect(self):
'''Attempt to connect'''
@@ -502,13 +505,14 @@ class TcpChecker: # pylint: disable=too-many-instance-attributes
if err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.CANCELLED):
logging.debug('TcpChecker._connect_async_cback() - %s', err.message) # pylint: disable=no-member
else:
- logging.info(
- 'Unable to verify TCP connectivity - (%-10s %-14s %s): %s',
- self._host_iface + ',',
- self._traddr.compressed + ',',
- self._trsvcid,
- err.message, # pylint: disable=no-member
- )
+ if self._verbose:
+ logging.info(
+ 'Unable to verify TCP connectivity - (%-10s %-14s %s): %s',
+ self._host_iface + ',',
+ self._traddr.compressed + ',',
+ self._trsvcid,
+ err.message, # pylint: disable=no-member
+ )
self.close()