summaryrefslogtreecommitdiffstats
path: root/staslib
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-10 10:25:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-10 10:25:04 +0000
commit8622cbe476ee19b12d6d4ea77250146d5cb8717f (patch)
tree06a46583880489d4fba8f2f5c4450a23c33f58cc /staslib
parentAdding upstream version 2.3. (diff)
downloadnvme-stas-upstream.tar.xz
nvme-stas-upstream.zip
Adding upstream version 2.3.1.upstream/2.3.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--staslib/avahi.py2
-rw-r--r--staslib/conf.py2
-rw-r--r--staslib/ctrl.py4
-rw-r--r--staslib/gutil.py2
-rw-r--r--staslib/iputil.py20
-rw-r--r--staslib/meson.build11
-rw-r--r--staslib/service.py2
-rw-r--r--staslib/stas.py6
8 files changed, 20 insertions, 29 deletions
diff --git a/staslib/avahi.py b/staslib/avahi.py
index f91e489..cd4d1f9 100644
--- a/staslib/avahi.py
+++ b/staslib/avahi.py
@@ -580,7 +580,7 @@ class Avahi: # pylint: disable=too-many-instance-attributes
self._check_for_duplicate_ips()
- def _failure_handler( # pylint: disable=no-self-use
+ def _failure_handler(
self,
_connection,
_sender_name: str,
diff --git a/staslib/conf.py b/staslib/conf.py
index 4497698..4dd411c 100644
--- a/staslib/conf.py
+++ b/staslib/conf.py
@@ -659,7 +659,7 @@ class NvmeOptions(metaclass=singleton.Singleton):
'dhchap_ctrl_secret': defs.KERNEL_VERSION >= defs.KERNEL_CTRLKEY_MIN_VERSION,
}
- # If some of the options are False, we need to check wether they can be
+ # If some of the options are False, we need to check whether they can be
# read from '/dev/nvme-fabrics'. This method allows us to determine that
# an older kernel actually supports a specific option because it was
# backported to that kernel.
diff --git a/staslib/ctrl.py b/staslib/ctrl.py
index 9f415b3..e4cda6b 100644
--- a/staslib/ctrl.py
+++ b/staslib/ctrl.py
@@ -425,7 +425,7 @@ class Dc(Controller):
@property
def origin(self):
- '''@brief Return how this controller came into existance. Was it
+ '''@brief Return how this controller came into existence. Was it
"discovered" through mDNS service discovery (TP8009), was it manually
"configured" in stafd.conf, or was it a "referral".
'''
@@ -853,6 +853,6 @@ class Ioc(Controller):
self._try_to_connect_deferred.schedule()
def _should_try_to_reconnect(self):
- '''@brief This is used to determine when it's time to stop trying toi connect'''
+ '''@brief This is used to determine when it's time to stop trying to connect'''
max_connect_attempts = conf.SvcConf().connect_attempts_on_ncc if self.ncc else 0
return max_connect_attempts == 0 or self._connect_attempts < max_connect_attempts
diff --git a/staslib/gutil.py b/staslib/gutil.py
index 7bdc117..4cdc087 100644
--- a/staslib/gutil.py
+++ b/staslib/gutil.py
@@ -250,7 +250,7 @@ class _TaskRunner(GObject.Object):
task.run_in_thread(in_thread_exec)
return task
- def communicate_finish(self, result): # pylint: disable=no-self-use
+ def communicate_finish(self, result):
'''@brief Use this function in your callback (see @cb_function) to
extract data from the result object.
diff --git a/staslib/iputil.py b/staslib/iputil.py
index d5e93dd..910ae65 100644
--- a/staslib/iputil.py
+++ b/staslib/iputil.py
@@ -42,7 +42,7 @@ def _nlmsghdr(nlmsg_type, nlmsg_flags, nlmsg_seq, nlmsg_pid, msg_len: int):
__u32 nlmsg_pid; /* Sending process port ID */
};
'''
- return struct.pack('<LHHLL', NLMSG_LENGTH(msg_len), nlmsg_type, nlmsg_flags, nlmsg_seq, nlmsg_pid)
+ return struct.pack('=LHHLL', NLMSG_LENGTH(msg_len), nlmsg_type, nlmsg_flags, nlmsg_seq, nlmsg_pid)
def _ifaddrmsg(family=0, prefixlen=0, flags=0, scope=0, index=0):
@@ -55,7 +55,7 @@ def _ifaddrmsg(family=0, prefixlen=0, flags=0, scope=0, index=0):
__u32 ifa_index; /* Link index */
};
'''
- return struct.pack('<BBBBL', family, prefixlen, flags, scope, index)
+ return struct.pack('=BBBBL', family, prefixlen, flags, scope, index)
def _ifinfomsg(family=0, dev_type=0, index=0, flags=0, change=0):
@@ -69,7 +69,7 @@ def _ifinfomsg(family=0, dev_type=0, index=0, flags=0, change=0):
unsigned int ifi_change; /* change mask: IFF_* */
};
'''
- return struct.pack('<BBHiII', family, 0, dev_type, index, flags, change)
+ return struct.pack('=BBHiII', family, 0, dev_type, index, flags, change)
def _nlmsg(nlmsg_type, nlmsg_flags, msg: bytes):
@@ -102,7 +102,7 @@ def mac2iface(mac: str): # pylint: disable=too-many-locals
nlmsg += sock.recv(8192)
nlmsghdr = nlmsg[nlmsg_idx : nlmsg_idx + NLMSG_HDRLEN]
- nlmsg_len, nlmsg_type, _, _, _ = struct.unpack('<LHHLL', nlmsghdr)
+ nlmsg_len, nlmsg_type, _, _, _ = struct.unpack('=LHHLL', nlmsghdr)
if nlmsg_type == NLMSG_DONE:
break
@@ -110,13 +110,13 @@ def mac2iface(mac: str): # pylint: disable=too-many-locals
if nlmsg_type == RTM_BASE:
msg_indx = nlmsg_idx + NLMSG_HDRLEN
msg = nlmsg[msg_indx : msg_indx + IFINFOMSG_SZ] # ifinfomsg
- _, _, ifi_type, ifi_index, _, _ = struct.unpack('<BBHiII', msg)
+ _, _, ifi_type, ifi_index, _, _ = struct.unpack('=BBHiII', msg)
if ifi_type in (ARPHRD_LOOPBACK, ARPHRD_ETHER):
rtattr_indx = msg_indx + IFINFOMSG_SZ
while rtattr_indx < (nlmsg_idx + nlmsg_len):
rtattr = nlmsg[rtattr_indx : rtattr_indx + RTATTR_SZ]
- rta_len, rta_type = struct.unpack('<HH', rtattr)
+ rta_len, rta_type = struct.unpack('=HH', rtattr)
if rta_type == IFLA_ADDRESS:
data = nlmsg[rtattr_indx + RTATTR_SZ : rtattr_indx + rta_len]
if _data_matches_mac(data, mac):
@@ -132,7 +132,7 @@ def mac2iface(mac: str): # pylint: disable=too-many-locals
# ******************************************************************************
def ip_equal(ip1, ip2):
- '''Check whther two IP addresses are equal.
+ '''Check whether two IP addresses are equal.
@param ip1: IPv4Address or IPv6Address object
@param ip2: IPv4Address or IPv6Address object
'''
@@ -206,7 +206,7 @@ def net_if_addrs(): # pylint: disable=too-many-locals
nlmsg += sock.recv(8192)
nlmsghdr = nlmsg[nlmsg_idx : nlmsg_idx + NLMSG_HDRLEN]
- nlmsg_len, nlmsg_type, _, _, _ = struct.unpack('<LHHLL', nlmsghdr)
+ nlmsg_len, nlmsg_type, _, _, _ = struct.unpack('=LHHLL', nlmsghdr)
if nlmsg_type == NLMSG_DONE:
break
@@ -214,7 +214,7 @@ def net_if_addrs(): # pylint: disable=too-many-locals
if nlmsg_type == RTM_NEWADDR:
msg_indx = nlmsg_idx + NLMSG_HDRLEN
msg = nlmsg[msg_indx : msg_indx + IFADDRMSG_SZ] # ifaddrmsg
- ifa_family, _, _, _, ifa_index = struct.unpack('<BBBBL', msg)
+ ifa_family, _, _, _, ifa_index = struct.unpack('=BBBBL', msg)
if ifa_family in (socket.AF_INET, socket.AF_INET6):
interfaces.setdefault(ifa_index, {4: [], 6: []})
@@ -222,7 +222,7 @@ def net_if_addrs(): # pylint: disable=too-many-locals
rtattr_indx = msg_indx + IFADDRMSG_SZ
while rtattr_indx < (nlmsg_idx + nlmsg_len):
rtattr = nlmsg[rtattr_indx : rtattr_indx + RTATTR_SZ]
- rta_len, rta_type = struct.unpack('<HH', rtattr)
+ rta_len, rta_type = struct.unpack('=HH', rtattr)
if rta_type == IFLA_IFNAME:
data = nlmsg[rtattr_indx + RTATTR_SZ : rtattr_indx + rta_len]
diff --git a/staslib/meson.build b/staslib/meson.build
index 1658d3c..1642e0f 100644
--- a/staslib/meson.build
+++ b/staslib/meson.build
@@ -49,13 +49,4 @@ python3.install_sources(
subdir: 'staslib',
)
-#===============================================================================
-# Make a list of modules to lint
-skip = ['stafd.idl', 'stacd.idl']
-foreach file: files_to_install
- fname = fs.name('@0@'.format(file))
- if fname not in skip
- modules_to_lint += file
- endif
-endforeach
-
+packages_to_lint += meson.current_build_dir()
diff --git a/staslib/service.py b/staslib/service.py
index 08a775a..19acec3 100644
--- a/staslib/service.py
+++ b/staslib/service.py
@@ -725,7 +725,7 @@ class Staf(Service):
'''@brief Finish discovery controllers configuration after
hostnames (if any) have been resolved. All the logic associated
with discovery controller creation/deletion is found here. To
- avoid calling this algorith repetitively for each and every events,
+ avoid calling this algorithm repetitively for each and every events,
it is called after a soaking period controlled by self._cfg_soak_tmr.
@param configured_ctrl_list: List of TIDs configured in stafd.conf with
diff --git a/staslib/stas.py b/staslib/stas.py
index 47ce5de..b2cb53e 100644
--- a/staslib/stas.py
+++ b/staslib/stas.py
@@ -29,7 +29,7 @@ except ImportError:
# Pre Python 3.9 backport of importlib.resources (if installed)
from importlib_resources import files
except ImportError:
- # Less efficient, but avalable on older versions of Python
+ # Less efficient, but available on older versions of Python
import pkg_resources
def load_idl(idl_fname):
@@ -248,7 +248,7 @@ class ControllerABC(abc.ABC):
self._try_to_connect_deferred.schedule()
return GLib.SOURCE_REMOVE
- def _should_try_to_reconnect(self): # pylint: disable=no-self-use
+ def _should_try_to_reconnect(self):
return True
def _try_to_connect(self):
@@ -537,7 +537,7 @@ class ServiceABC(abc.ABC): # pylint: disable=too-many-instance-attributes
# controllers with traddr specified as hostname instead of IP address.
# Because of this, we need to remove those excluded elements before
# running name resolution. And we will need to remove excluded
- # elements after name resolution is complete (i.e. in the calback
+ # elements after name resolution is complete (i.e. in the callback
# function _config_ctrls_finish)
logging.debug('ServiceABC._config_ctrls()')
configured_controllers = [