Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUNperVDI supports multipathed LUN #460

Merged
merged 1 commit into from
Oct 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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