From 3172d73fa106a28466fab40975417b771159379c Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 22 Apr 2025 11:10:24 +0200 Subject: [PATCH 1/2] chore(.github/workflows): use ubuntu-24.04 Previous version is no longer available. Signed-off-by: Ronan Abhamon --- .github/workflows/main.yml | 4 ++-- dev_requirements.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d89b968c4..015d64126 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,14 +23,14 @@ jobs: mypy . build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - name: Set up Python 3 uses: actions/setup-python@v4 with: - python-version: '3.6' + python-version: '3.x' - name: Install dependencies run: | diff --git a/dev_requirements.txt b/dev_requirements.txt index f25f76868..5fbd5907f 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,5 +1,5 @@ coverage -astroid==2.3.3 -pylint==2.4.4 +astroid +pylint bitarray python-linstor From f3b1bbdde1173d43eeaee4c6cc41e64d22ca842d Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 22 Apr 2025 11:27:12 +0200 Subject: [PATCH 2/2] Fix warns reported by new github workflow Signed-off-by: Ronan Abhamon --- drivers/LUNperVDI.py | 1 + drivers/LVHDSR.py | 5 +++-- drivers/LinstorSR.py | 3 +-- drivers/cleanup.py | 1 + drivers/iscsilib.py | 2 +- drivers/mpathcount.py | 4 ++-- drivers/resetvdis.py | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/LUNperVDI.py b/drivers/LUNperVDI.py index e3583a592..070c67117 100755 --- a/drivers/LUNperVDI.py +++ b/drivers/LUNperVDI.py @@ -87,6 +87,7 @@ def create(self, sr_uuid, vdi_uuid, size) -> str: VDIs = util._getVDIs(self.sr) self.sr._loadvdis() smallest = 0 + v = {} for vdi in VDIs: if not vdi['managed'] \ and int(vdi['virtual_size']) >= int(size) \ diff --git a/drivers/LVHDSR.py b/drivers/LVHDSR.py index 852cad3e5..52d257dfe 100755 --- a/drivers/LVHDSR.py +++ b/drivers/LVHDSR.py @@ -222,6 +222,7 @@ def load(self, sr_uuid) -> None: for key in self.lvmCache.lvs.keys(): # if the lvname has a uuid in it type = None + vdi = None if contains_uuid_regex.search(key) is not None: if key.startswith(lvhdutil.LV_PREFIX[vhdutil.VDI_TYPE_VHD]): type = vhdutil.VDI_TYPE_VHD @@ -997,8 +998,8 @@ def _undoCloneOp(self, lvs, origUuid, baseUuid, clonUuid): self.lvActivator.activate(baseUuid, base.name, False) origRefcountNormal = 1 vhdInfo = vhdutil.getVHDInfo(basePath, lvhdutil.extractUuid, False) - if base.vdiType == vhdutil.VDI_TYPE_VHD and vhdInfo.hidden: - vhdutil.setHidden(basePath, False) + if vhdInfo.hidden: + vhdutil.setHidden(basePath, False) elif base.vdiType == vhdutil.VDI_TYPE_RAW and base.hidden: self.lvmCache.setHidden(base.name, False) diff --git a/drivers/LinstorSR.py b/drivers/LinstorSR.py index c2579a539..2ecb0e384 100755 --- a/drivers/LinstorSR.py +++ b/drivers/LinstorSR.py @@ -1205,8 +1205,7 @@ def _load_vdis_ex(self): if USE_KEY_HASH and vdi.vdi_type == vhdutil.VDI_TYPE_VHD: # TODO: Replace pylint comment with this feature when possible: # https://github.com/PyCQA/pylint/pull/2926 - vdi.sm_config_override['key_hash'] = \ - self._vhdutil.get_key_hash(vdi_uuid) # pylint: disable = E1120 + vdi.sm_config_override['key_hash'] = self._vhdutil.get_key_hash(vdi_uuid) # pylint: disable = E1120 # 4.c. Update CBT status of disks either just added # or already in XAPI. diff --git a/drivers/cleanup.py b/drivers/cleanup.py index 7bba0a059..4943c95ef 100755 --- a/drivers/cleanup.py +++ b/drivers/cleanup.py @@ -4174,6 +4174,7 @@ def abort_optional_reenable(uuid): # def main(): action = "" + maxAge = 0 uuid = "" background = False force = False diff --git a/drivers/iscsilib.py b/drivers/iscsilib.py index e54de1bcd..27d34a546 100644 --- a/drivers/iscsilib.py +++ b/drivers/iscsilib.py @@ -248,7 +248,7 @@ def get_node_config (portal, targetIQN): ini_sec = "root" str_fp = io.StringIO("[%s]\n%s" % (ini_sec, stdout)) parser = RawConfigParser() - parser.readfp(str_fp) + parser.read_file(str_fp) str_fp.close() return dict(parser.items(ini_sec)) diff --git a/drivers/mpathcount.py b/drivers/mpathcount.py index 43285edc6..93d566693 100755 --- a/drivers/mpathcount.py +++ b/drivers/mpathcount.py @@ -89,8 +89,8 @@ def match_pathup(s): match = re.match(r'.*\d+:\d+:\d+:\d+\s+\S+\s+\S+\s+\S+\s+(\S+)', s) if match: path_status = match.group(1) - if path_status in ['faulty', 'shaky', 'failed']: - return False + if path_status in ['faulty', 'shaky', 'failed']: + return False return True diff --git a/drivers/resetvdis.py b/drivers/resetvdis.py index 81938d4c8..61454f849 100755 --- a/drivers/resetvdis.py +++ b/drivers/resetvdis.py @@ -21,6 +21,7 @@ import cleanup import util import lock +import sys import XenAPI # pylint: disable=import-error @@ -141,7 +142,6 @@ def usage(): sys.exit(1) if __name__ == '__main__': - import sys import atexit if len(sys.argv) not in [3, 4, 5]: