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 authored and MarkSymsCtx committed Oct 25, 2019
1 parent aaac364 commit e58bc97
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/LUNperVDI.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# LUNperVDI: Generic Raw LUN handler, used by HBASR and ISCSISR
#

import os
import VDI, util
import scsiutil
import xs_errors
Expand Down Expand Up @@ -111,13 +112,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 e58bc97

Please sign in to comment.