Skip to content

Commit 0050726

Browse files
authored
Merge branch 'master' into CP-52793
2 parents d2bbc00 + 1afbc3f commit 0050726

22 files changed

+263
-87
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-24.04
88

99
steps:
1010
- uses: actions/checkout@v3
1111
- name: Set up Python 3
1212
uses: actions/setup-python@v4
13-
with:
14-
python-version: '3.6'
1513

1614
- name: Install dependencies
1715
run: |

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ SM_LIBS += constants
5959
SM_LIBS += cbtutil
6060
SM_LIBS += sr_health_check
6161

62-
UDEV_RULES = 65-multipath 55-xs-mpath-scsidev 57-usb 58-xapi
62+
63+
UDEV_RULES = 65-multipath 55-xs-mpath-scsidev 57-usb 58-xapi 99-purestorage
6364
MPATH_CONF = multipath.conf
6465
MPATH_CUSTOM_CONF = custom.conf
6566
SMLOG_CONF = SMlog
@@ -200,7 +201,6 @@ install: precheck
200201
$(MAKE) -C dcopy install DESTDIR=$(SM_STAGING)
201202
ln -sf $(SM_DEST)blktap2.py $(SM_STAGING)$(BIN_DEST)/blktap2
202203
ln -sf $(SM_DEST)lcache.py $(SM_STAGING)$(BIN_DEST)tapdisk-cache-stats
203-
ln -sf /dev/null $(SM_STAGING)$(UDEV_RULES_DIR)/69-dm-lvm-metad.rules
204204
install -m 755 scripts/xs-mpath-scsidev.sh $(SM_STAGING)$(UDEV_SCRIPTS_DIR)
205205
install -m 755 scripts/make-dummy-sr $(SM_STAGING)$(LIBEXEC)
206206
install -m 755 scripts/storage-init $(SM_STAGING)$(LIBEXEC)

dev_requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
coverage
2-
astroid==2.3.3
3-
pylint==2.4.4
2+
astroid
3+
pylint
44
bitarray

drivers/BaseISCSI.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,10 @@ def detach(self, sr_uuid, delete=False):
441441
except:
442442
pass
443443
if 'SCSIid' in self.dconf:
444-
self.mpathmodule.reset(self.dconf['SCSIid'], explicit_unmap=True)
445-
keys.append("mpath-" + self.dconf['SCSIid'])
444+
scsi_id = self.dconf['SCSIid']
445+
util.SMlog(f"Resetting mpath on {scsi_id}")
446+
self.mpathmodule.reset(scsi_id, explicit_unmap=True)
447+
keys.append("mpath-" + scsi_id)
446448

447449
# Remove iscsi_sessions and multipathed keys
448450
if pbdref is not None:

drivers/LUNperVDI.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def create(self, sr_uuid, vdi_uuid, size):
8282
VDIs = util._getVDIs(self.sr)
8383
self.sr._loadvdis()
8484
smallest = 0
85+
v = None
8586
for vdi in VDIs:
8687
if not vdi['managed'] \
8788
and int(vdi['virtual_size']) >= int(size) \

drivers/LVHDSR.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def load(self, sr_uuid):
205205
re.compile("^.*[0-9a-f]{8}-(([0-9a-f]{4})-){3}[0-9a-f]{12}.*")
206206
self.storageVDIs = {}
207207

208+
vdi = None
208209
for key in self.lvmCache.lvs.keys():
209210
# if the lvname has a uuid in it
210211
type = None
@@ -969,6 +970,7 @@ def _undoCloneOp(self, lvs, origUuid, baseUuid, clonUuid):
969970
origRefcountNormal = 0
970971

971972
# un-hide the parent
973+
vhdInfo = None
972974
if base.vdiType == vhdutil.VDI_TYPE_VHD:
973975
self.lvActivator.activate(baseUuid, base.name, False)
974976
origRefcountNormal = 1

drivers/LVHDoISCSISR.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ def attach(self, sr_uuid):
488488
def detach(self, sr_uuid):
489489
LVHDSR.LVHDSR.detach(self, sr_uuid)
490490
for i in self.iscsiSRs:
491+
util.SMlog(f'Detaching {i}')
491492
i.detach(sr_uuid)
492493

493494
def scan(self, sr_uuid):

drivers/SR.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ def __init__(self, srcmd, sr_uuid):
153153

154154
@staticmethod
155155
def from_uuid(session, sr_uuid):
156-
import imp
156+
import importlib.machinery
157+
import types
157158

158159
_SR = session.xenapi.SR
159160
sr_ref = _SR.get_by_uuid(sr_uuid)
@@ -169,7 +170,9 @@ def from_uuid(session, sr_uuid):
169170
driver_real = os.path.realpath(driver_path)
170171
module_name = os.path.basename(driver_path)
171172

172-
module = imp.load_source(module_name, driver_real)
173+
loader = importlib.machinery.SourceFileLoader(module_name, driver_real)
174+
module = types.ModuleType(loader.name)
175+
loader.exec_module(module)
173176
target = driver(sm_type)
174177
# NB. get the host pbd's device_config
175178

@@ -186,6 +189,7 @@ def from_uuid(session, sr_uuid):
186189
# FIXME
187190

188191
from SRCommand import SRCommand
192+
# pylint: disable=E1101
189193
cmd = SRCommand(module.DRIVER_INFO)
190194
cmd.dconf = device_config
191195
cmd.params = {'session_ref': session._session,

drivers/cleanup.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,6 @@ def countBits(bitmap1, bitmap2):
250250
return count
251251
countBits = staticmethod(countBits)
252252

253-
def getThisScript():
254-
thisScript = util.get_real_path(__file__)
255-
if thisScript.endswith(".pyc"):
256-
thisScript = thisScript[:-1]
257-
return thisScript
258-
getThisScript = staticmethod(getThisScript)
259-
260253

261254
################################################################################
262255
#
@@ -3489,6 +3482,7 @@ def main():
34893482
background = False
34903483
force = False
34913484
dryRun = False
3485+
maxAge = 0
34923486
debug_cmd = ""
34933487
vdi_uuid = ""
34943488
shortArgs = "gGc:aqxu:bfdt:v:"

drivers/iscsilib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def get_node_config (portal, targetIQN):
248248
ini_sec = "root"
249249
str_fp = io.StringIO("[%s]\n%s" % (ini_sec, stdout))
250250
parser = RawConfigParser()
251-
parser.readfp(str_fp)
251+
parser.read_file(str_fp)
252252
str_fp.close()
253253
return dict(parser.items(ini_sec))
254254

0 commit comments

Comments
 (0)