Skip to content

Commit

Permalink
LUNperVDI supports multipathed LUN
Browse files Browse the repository at this point in the history
Snippets are copied from BaseISCSI.py.

Signed-off-by: Robin Lee <cheeselee@fedoraproject.org>
  • Loading branch information
Robin Lee committed Oct 25, 2019
1 parent aaac364 commit 3965209
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/LUNperVDI.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,22 @@ def attach(self, sr_uuid, vdi_uuid):
raise xs_errors.XenError('VDIUnavailable')
if not util.pathexists(self.path):
self.sr.refresh()
if self.sm_config.has_key('SCSIid'):
if self.sr.mpath == 'true':
self.sr.mpathmodule.refresh(self.sm_config['SCSIid'], 0)
devs = os.listdir("/dev/disk/by-scsid/%s" % self.sm_config['SCSIid'])
for dev in devs:
realdev = os.path.realpath("/dev/disk/by-scsid/%s/%s" % (self.sm_config['SCSIid'], dev))
util.set_scheduler(realdev.split("/")[-1], "noop")
if not util.wait_for_path(self.path, MAX_TIMEOUT):
util.SMlog("Unable to detect LUN attached to host [%s]" % self.sr.path)
raise xs_errors.XenError('VDIUnavailable')
return super(RAWVDI, self).attach(sr_uuid, vdi_uuid)

def detach(self, sr_uuid, vdi_uuid):
self.sr._loadvdis()
if self.sm_config.has_key('SCSIid'):
self.sr.mpathmodule.reset(self.sm_config['SCSIid'], True) # explicitly unmap
if not self.sr.vdis.has_key(vdi_uuid):
raise xs_errors.XenError('VDIUnavailable')

Expand Down

0 comments on commit 3965209

Please sign in to comment.