diff --git a/.packit.yaml b/.packit.yaml index fa9bb3c8..5f4c5eeb 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -25,6 +25,10 @@ jobs: trigger: pull_request targets: - fedora-all + - centos-stream-8-x86_64 + - rhel-7-x86_64 + - rhel-8-x86_64 + - rhel-9-x86_64 srpm_build_deps: - wget diff --git a/plugin/arcconf_plugin/arcconf.py b/plugin/arcconf_plugin/arcconf.py index a51c3910..ccc26339 100644 --- a/plugin/arcconf_plugin/arcconf.py +++ b/plugin/arcconf_plugin/arcconf.py @@ -69,6 +69,7 @@ def _handle_errors(method): + def _wrapper(*args, **kwargs): try: return method(*args, **kwargs) diff --git a/plugin/arcconf_plugin/utils.py b/plugin/arcconf_plugin/utils.py index 051ae6e6..e506f4ee 100644 --- a/plugin/arcconf_plugin/utils.py +++ b/plugin/arcconf_plugin/utils.py @@ -37,6 +37,7 @@ def cmd_exec(cmds): class ExecError(Exception): + def __init__(self, cmd, errno, stdout, stderr, *args, **kwargs): Exception.__init__(self, *args, **kwargs) self.cmd = cmd diff --git a/plugin/hpsa_plugin/hpsa.py b/plugin/hpsa_plugin/hpsa.py index 27097691..20de8786 100644 --- a/plugin/hpsa_plugin/hpsa.py +++ b/plugin/hpsa_plugin/hpsa.py @@ -23,11 +23,11 @@ from lsm import (IPlugin, Client, Capabilities, VERSION, LsmError, ErrorNumber, uri_parse, System, Pool, size_human_2_size_bytes, search_property, Volume, Disk, LocalDisk, Battery, int_div) - from hpsa_plugin.utils import cmd_exec, ExecError def _handle_errors(method): + def _wrapper(*args, **kwargs): try: return method(*args, **kwargs) @@ -41,7 +41,7 @@ def _wrapper(*args, **kwargs): except ExecError as exec_error: if 'No controllers detected' in exec_error.stdout: raise LsmError(ErrorNumber.NOT_FOUND_SYSTEM, - "No HP SmartArray deteceted by ssacli.") + "No HP SmartArray detected by ssacli.") else: raise LsmError(ErrorNumber.PLUGIN_BUG, str(exec_error)) except Exception as common_error: @@ -719,7 +719,6 @@ def volumes(self, for array_key_name in list(ctrl_data[key_name].keys()): if not array_key_name.startswith("Logical Drive"): continue - lsm_vols.append( SmartArray._hp_ld_to_lsm_vol( ctrl_data[key_name][array_key_name], pool_id, diff --git a/plugin/hpsa_plugin/utils.py b/plugin/hpsa_plugin/utils.py index 7523488a..45edc9e8 100644 --- a/plugin/hpsa_plugin/utils.py +++ b/plugin/hpsa_plugin/utils.py @@ -37,6 +37,7 @@ def cmd_exec(cmds): class ExecError(Exception): + def __init__(self, cmd, errno, stdout, stderr, *args, **kwargs): Exception.__init__(self, *args, **kwargs) self.cmd = cmd diff --git a/plugin/local_plugin/local.py b/plugin/local_plugin/local.py index 2e2c6c74..b784172f 100644 --- a/plugin/local_plugin/local.py +++ b/plugin/local_plugin/local.py @@ -24,6 +24,7 @@ def _handle_errors(method): + def _wrapper(*args, **kwargs): try: return method(*args, **kwargs) diff --git a/plugin/megaraid_plugin/megaraid.py b/plugin/megaraid_plugin/megaraid.py index 846ce683..eee7233a 100644 --- a/plugin/megaraid_plugin/megaraid.py +++ b/plugin/megaraid_plugin/megaraid.py @@ -35,6 +35,7 @@ def _handle_errors(method): + def _wrapper(*args, **kwargs): try: return method(*args, **kwargs) @@ -531,13 +532,24 @@ def systems(self, flags=Client.FLAG_RSVD): ctrl_show_all_output["Version"]["Bios Version"], ctrl_show_all_output["Version"]["Firmware Version"]) - if ctrl_show_all_output["Capabilities"]["Enable JBOD"] == "Yes": - mode = System.MODE_HBA + if "Capabilities" in ctrl_show_all_output and \ + "Enable JBOD" in ctrl_show_all_output["Capabilities"]: + + if ctrl_show_all_output["Capabilities"]["Enable JBOD"] == "Yes": + mode = System.MODE_HBA + else: + mode = System.MODE_HARDWARE_RAID + # Notes for JBOD/HBA mode of MegaRAID: + # "storcli /c0/e9/s1 set jbod" require "storcli /c0 set jbod=on" + # be executed first. + elif "Status" in ctrl_show_all_output and \ + "Current Personality" in ctrl_show_all_output["Status"]: + if ctrl_show_all_output["Status"]["Current Personality"] == "HBA-Mode ": + mode = System.MODE_HBA + else: + mode = System.MODE_HBA else: - mode = System.MODE_HARDWARE_RAID - # Notes for JBOD/HBA mode of MegaRAID: - # "storcli /c0/e9/s1 set jbod" require "storcli /c0 set jbod=on" - # be excuted first. + mode = System.MODE_UNKNOWN rc_lsm_syss.append( System(sys_id, diff --git a/plugin/megaraid_plugin/utils.py b/plugin/megaraid_plugin/utils.py index 7523488a..45edc9e8 100644 --- a/plugin/megaraid_plugin/utils.py +++ b/plugin/megaraid_plugin/utils.py @@ -37,6 +37,7 @@ def cmd_exec(cmds): class ExecError(Exception): + def __init__(self, cmd, errno, stdout, stderr, *args, **kwargs): Exception.__init__(self, *args, **kwargs) self.cmd = cmd diff --git a/plugin/sim_plugin/simarray.py b/plugin/sim_plugin/simarray.py index af99447c..d837ae1f 100644 --- a/plugin/sim_plugin/simarray.py +++ b/plugin/sim_plugin/simarray.py @@ -28,6 +28,7 @@ def _handle_errors(method): + def wrapper(*args, **kargs): try: return method(*args, **kargs) diff --git a/plugin/sim_plugin/simulator.py b/plugin/sim_plugin/simulator.py index 77afe72a..36f28361 100644 --- a/plugin/sim_plugin/simulator.py +++ b/plugin/sim_plugin/simulator.py @@ -25,6 +25,7 @@ class SimPlugin(INfs, IStorageAreaNetwork): """ Simple class that implements enough to allow the framework to be exercised. """ + def __init__(self): self.uri = None self.password = None diff --git a/plugin/smispy_plugin/utils.py b/plugin/smispy_plugin/utils.py index cb957e4f..c7341b8d 100644 --- a/plugin/smispy_plugin/utils.py +++ b/plugin/smispy_plugin/utils.py @@ -34,6 +34,7 @@ def merge_list(list_a, list_b): def handle_cim_errors(method): + def cim_wrapper(*args, **kwargs): try: return method(*args, **kwargs) diff --git a/plugin/targetd_plugin/targetd.py b/plugin/targetd_plugin/targetd.py index 5603840d..0d5b5af6 100644 --- a/plugin/targetd_plugin/targetd.py +++ b/plugin/targetd_plugin/targetd.py @@ -58,6 +58,7 @@ def handle_errors(method): + def target_wrapper(*args, **kwargs): try: return method(*args, **kwargs) diff --git a/python_binding/lsm/_common.py b/python_binding/lsm/_common.py index c558405e..1220381d 100644 --- a/python_binding/lsm/_common.py +++ b/python_binding/lsm/_common.py @@ -409,6 +409,7 @@ class SocketEOF(Exception): @default_property('msg', doc='Error message') @default_property('data', doc='Optional error data') class LsmError(Exception): + def __init__(self, code, message, data=None, *args, **kwargs): """ Class represents an error. @@ -586,7 +587,9 @@ def return_requires(*types): needs to be language agnostic, so making sure we have the correct types is quite important. """ + def outer(func): + @functools.wraps(func) def inner(*args, **kwargs): r = func(*args, **kwargs) @@ -613,6 +616,7 @@ def inner(*args, **kwargs): class TestCommon(unittest.TestCase): + def setUp(self): pass diff --git a/python_binding/lsm/_data.py b/python_binding/lsm/_data.py index e3451008..968d9a2f 100644 --- a/python_binding/lsm/_data.py +++ b/python_binding/lsm/_data.py @@ -38,6 +38,7 @@ class DataEncoder(json.JSONEncoder): """ Custom json encoder for objects derived form ILsmData """ + def default(self, my_class): if not isinstance(my_class, IData): raise ValueError('incorrect class type:' + str(type(my_class))) @@ -49,6 +50,7 @@ class DataDecoder(json.JSONDecoder): """ Custom json decoder for objects derived from ILsmData """ + @staticmethod def __process_dict(d): """ @@ -100,6 +102,7 @@ class IData(with_metaclass(_ABCMeta, object)): Base class functionality of serializable classes. """ + def _to_dict(self): """ Represent the class as a dictionary @@ -722,6 +725,7 @@ def __init__(self, @default_property('ts', doc="Time stamp the snapshot was created") @default_property("plugin_data", doc="Private plugin data") class FsSnapshot(IData): + def __init__(self, _id, _name, _ts, _plugin_data=None): self._id = _id self._name = _name @@ -777,6 +781,7 @@ def __init__(self, @default_property('dest_block', doc="Destination logical block address") @default_property('block_count', doc="Number of blocks") class BlockRange(IData): + def __init__(self, _src_block, _dest_block, _block_count): self._src_block = _src_block self._dest_block = _dest_block diff --git a/python_binding/lsm/_iplugin.py b/python_binding/lsm/_iplugin.py index 1855f6c5..815df954 100644 --- a/python_binding/lsm/_iplugin.py +++ b/python_binding/lsm/_iplugin.py @@ -25,6 +25,7 @@ class IPlugin(with_metaclass(_ABCMeta, object)): Plug-in interface that all plug-ins must implement for basic operation. """ + @_abstractmethod def plugin_register(self, uri, password, timeout, flags=0): """ @@ -126,6 +127,7 @@ def systems(self, flags=0): class IStorageAreaNetwork(IPlugin): + def volumes(self, search_key=None, search_value=None, flags=0): """ Returns an array of volume objects @@ -333,6 +335,7 @@ class INetworkAttachedStorage(IPlugin): """ Class the represents Network attached storage (Common NFS/CIFS operations) """ + def fs(self, search_key=None, search_value=None, flags=0): """ Returns a list of file systems on the controller. Raises LsmError on @@ -474,6 +477,7 @@ def fs_child_dependency_rm(self, fs, files, flags=0): class INfs(INetworkAttachedStorage): + def export_auth(self, flags=0): """ Returns the types of authentication that are available for NFS diff --git a/python_binding/lsm/_local_disk.py b/python_binding/lsm/_local_disk.py index ffb6bebb..784bca48 100644 --- a/python_binding/lsm/_local_disk.py +++ b/python_binding/lsm/_local_disk.py @@ -36,6 +36,7 @@ def _use_c_lib_function(func_ref, arg): class LocalDisk(object): + @staticmethod def vpd83_search(vpd83): """ diff --git a/python_binding/lsm/_pluginrunner.py b/python_binding/lsm/_pluginrunner.py index 1f0bb433..2be4b222 100644 --- a/python_binding/lsm/_pluginrunner.py +++ b/python_binding/lsm/_pluginrunner.py @@ -42,6 +42,7 @@ class PluginRunner(object): Plug-in side common code which uses the passed in plugin to do meaningful work. """ + @staticmethod def _is_number(val): """ diff --git a/python_binding/lsm/_transport.py b/python_binding/lsm/_transport.py index 2d385f4f..c5148c37 100644 --- a/python_binding/lsm/_transport.py +++ b/python_binding/lsm/_transport.py @@ -215,6 +215,7 @@ def _server(s): class _TestTransport(unittest.TestCase): + def setUp(self): (self.c, self.s) = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM) diff --git a/test/plugin_test.py.in b/test/plugin_test.py.in index d9c9f5e1..b6bf3910 100755 --- a/test/plugin_test.py.in +++ b/test/plugin_test.py.in @@ -80,6 +80,7 @@ def mb_in_bytes(mib): def record_result(method): + def recorder(*args, **kwargs): try: result = method(*args, **kwargs) @@ -119,6 +120,7 @@ def r_iqn(): class Duration(object): + def __init__(self): self.start = 0 self.end = 0 diff --git a/tools/basic_check/local_check.py.in b/tools/basic_check/local_check.py.in index 8e49f68a..e2c79400 100644 --- a/tools/basic_check/local_check.py.in +++ b/tools/basic_check/local_check.py.in @@ -37,6 +37,7 @@ def warn(vol, blk_paths, msg): class LocalVol(object): + def __init__(self, vol, blk_paths, sys, cap): self.vol = vol self.blk_paths = blk_paths @@ -76,6 +77,7 @@ SUGGEST: "{SUGGEST}" class SanityCheck(unittest.TestCase): + def setUp(self): uri = None if os.getenv('LSMCLI_URI') is not None: diff --git a/tools/lsmcli/cmdline.py b/tools/lsmcli/cmdline.py index 2676d141..c89e0295 100644 --- a/tools/lsmcli/cmdline.py +++ b/tools/lsmcli/cmdline.py @@ -412,6 +412,7 @@ def _add_sd_paths(lsm_obj): # This class represents a command line argument error class ArgError(Exception): + def __init__(self, message, *args, **kwargs): """ Class represents an error. @@ -452,6 +453,7 @@ def _check_network_host(addr): class PluginFork: """Container for plugin fork data""" + def __init__(self, plugin_exe): self.uds_dir = tempfile.mkdtemp(prefix="LSM_DEV_") self.uds_socket_file = os.path.join(self.uds_dir, "uds_path") @@ -1856,6 +1858,7 @@ def volume_replicate(self, args): # Check to see if block ranges are overlapping @staticmethod def _check_overlap(ranges): + def _overlap(r, member): for i in range(1, len(r)): ps = getattr(r[i - 1], member) # Previous start diff --git a/tools/lsmcli/data_display.py b/tools/lsmcli/data_display.py index 54e6fbec..bdb52f9a 100644 --- a/tools/lsmcli/data_display.py +++ b/tools/lsmcli/data_display.py @@ -330,6 +330,7 @@ def disk_link_speed_to_str(link_speed): class PlugData(object): + def __init__(self, description, plugin_version): self.desc = description self.version = plugin_version @@ -398,6 +399,7 @@ def member_type_to_str(member_type): class VcrCap(object): + def __init__(self, system_id, raid_types, strip_sizes): self.system_id = system_id self.raid_types = raid_types @@ -503,6 +505,7 @@ def r_cache_status_to_str(r_cache_status): class DisplayData(object): + def __init__(self): pass