Skip to content

Commit

Permalink
Remove code conditional on mpp_luncheck.is_RdacLun which has only eve…
Browse files Browse the repository at this point in the history
…r returned False for some time

Signed-off-by: Mark Syms <mark.syms@citrix.com>
  • Loading branch information
MarkSymsCtx committed Feb 13, 2019
1 parent 0357016 commit be0a528
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 360 deletions.
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ SM_LIBS += metadata
SM_LIBS += lvmanager
SM_LIBS += blktap2
SM_LIBS += mpp_mpathutil
SM_LIBS += mpp_luncheck
SM_LIBS += updatempppathd
SM_LIBS += lcache
SM_LIBS += resetvdis
SM_LIBS += B_util
Expand Down Expand Up @@ -157,8 +155,6 @@ install: precheck
$(SM_STAGING)/$(INIT_DIR)
install -m 644 etc/logrotate.d/$(SMLOG_CONF) \
$(SM_STAGING)/$(LOGROTATE_DIR)
install -m 644 drivers/updatempppathd.service \
$(SM_STAGING)/$(SYSTEMD_SERVICE_DIR)
install -m 644 etc/make-dummy-sr.service \
$(SM_STAGING)/$(SYSTEMD_SERVICE_DIR)
install -m 644 snapwatchd/snapwatchd.service \
Expand Down
11 changes: 1 addition & 10 deletions drivers/LVHDoHBASR.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import scsiutil
import mpath_cli
import glob
import mpp_luncheck

CAPABILITIES = ["SR_PROBE", "SR_UPDATE", "SR_METADATA", "SR_TRIM",
"VDI_CREATE", "VDI_DELETE", "VDI_ATTACH", "VDI_DETACH",
Expand Down Expand Up @@ -160,15 +159,7 @@ def probe(self):
pass

if self.dconf['SCSIid'] in maps:
if (mpp_luncheck.is_RdacLun(self.dconf['SCSIid'])):
mpath_cli.remove_map(self.dconf['SCSIid'])
else:
raise xs_errors.XenError('SRInUse')
else:
if (mpp_luncheck.is_RdacLun(self.dconf['SCSIid'])):
link=glob.glob('/dev/disk/mpInuse/%s-*' % self.dconf['SCSIid'])
if (len(link)):
raise xs_errors.XenError('SRInUse')
raise xs_errors.XenError('SRInUse')

self.mpathmodule.refresh(self.SCSIid,0)

Expand Down
23 changes: 3 additions & 20 deletions drivers/LVHDoISCSISR.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import xmlrpclib
import mpath_cli, iscsilib
import glob, copy
import mpp_luncheck
import scsiutil
import xml.dom.minidom

Expand Down Expand Up @@ -397,18 +396,11 @@ def _LUNprint(self, sr_uuid):
nluns=len(luns)-1 # remove the line relating to the final \n
# check if the LUNs are MPP-RDAC Luns
scsi_id = scsiutil.getSCSIid(sgdev)
mpp_lun = False
if (mpp_luncheck.is_RdacLun(scsi_id)):
mpp_lun = True
link=glob.glob('/dev/disk/by-scsibus/%s-*' % scsi_id)
mpp_adapter = link[0].split('/')[-1].split('-')[-1].split(':')[0]

# make sure we've got that many sg devices present
for i in range(0,30):
luns=scsiutil._dosgscan()
sgdevs=filter(lambda r: r[1]==adapter, luns)
if mpp_lun:
sgdevs.extend(filter(lambda r: r[1]==mpp_adapter, luns))
if len(sgdevs)>=nluns:
util.SMlog("Got all %d sg devices" % nluns)
break
Expand Down Expand Up @@ -542,22 +534,13 @@ def probe(self):
# as this will remove it (which may well be in use).
if self.mpath == 'true' and self.dconf.has_key('SCSIid'):
maps = []
mpp_lun = False
try:
if (mpp_luncheck.is_RdacLun(self.dconf['SCSIid'])):
mpp_lun = True
link=glob.glob('/dev/disk/mpInuse/%s-*' % self.dconf['SCSIid'])
else:
maps = mpath_cli.list_maps()
maps = mpath_cli.list_maps()
except:
pass

if (mpp_lun):
if (len(link)):
raise xs_errors.XenError('SRInUse')
else:
if self.dconf['SCSIid'] in maps:
raise xs_errors.XenError('SRInUse')
if self.dconf['SCSIid'] in maps:
raise xs_errors.XenError('SRInUse')

self.iscsi.attach(self.uuid)
if not self.iscsi._attach_LUN_bySCSIid(self.SCSIid):
Expand Down
8 changes: 0 additions & 8 deletions drivers/OCFSoISCSISR.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import xmlrpclib
import mpath_cli, iscsilib
import glob, copy
import mpp_luncheck
import scsiutil
import xml.dom.minidom

Expand Down Expand Up @@ -383,18 +382,11 @@ def _LUNprint(self, sr_uuid):
nluns=len(luns)-1 # remove the line relating to the final \n
# check if the LUNs are MPP-RDAC Luns
scsi_id = scsiutil.getSCSIid(sgdev)
mpp_lun = False
if (mpp_luncheck.is_RdacLun(scsi_id)):
mpp_lun = True
link=glob.glob('/dev/disk/by-scsibus/%s-*' % scsi_id)
mpp_adapter = link[0].split('/')[-1].split('-')[-1].split(':')[0]

# make sure we've got that many sg devices present
for i in range(0,30):
luns=scsiutil._dosgscan()
sgdevs=filter(lambda r: r[1]==adapter, luns)
if mpp_lun:
sgdevs.extend(filter(lambda r: r[1]==mpp_adapter, luns))
if len(sgdevs)>=nluns:
util.SMlog("Got all %d sg devices" % nluns)
break
Expand Down
65 changes: 5 additions & 60 deletions drivers/mpath_dmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import glob
import time
import scsiutil
import mpp_luncheck
import wwid_conf
import errno

Expand All @@ -37,7 +36,6 @@
DEVBYSCSIPATH = "/dev/disk/by-scsibus"
DEVBYMPPPATH = "/dev/disk/by-mpp"
SYSFS_PATH='/sys/class/scsi_host'
UMPD_PATH='/var/run/updatempppathd.py.pid'
MP_INUSEDIR = "/dev/disk/mpInuse"

MPPGETAIDLNOBIN = "/opt/xensource/bin/xe-get-arrayid-lunnum"
Expand All @@ -47,14 +45,6 @@ def _is_mpath_daemon_running():
(rc,stdout,stderr) = util.doexec(cmd)
return (rc==0)

def _is_mpp_daemon_running():
#cmd = ["/sbin/pidof", "-s", "/opt/xensource/sm/updatempppathd.py"]
#(rc,stdout,stderr) = util.doexec(cmd)
if os.path.exists(UMPD_PATH):
return True
else:
return False

def activate_MPdev(sid, dst):
try:
os.mkdir(MP_INUSEDIR)
Expand All @@ -63,34 +53,18 @@ def activate_MPdev(sid, dst):
pass
else:
raise
if (mpp_luncheck.is_RdacLun(sid)):
suffix = get_TargetID_LunNUM(sid)
sid_with_suffix = sid + "-" + suffix
path = os.path.join(MP_INUSEDIR, sid_with_suffix)
else:
path = os.path.join(MP_INUSEDIR, sid)
path = os.path.join(MP_INUSEDIR, sid)
cmd = ['ln', '-sf', dst, path]
util.pread2(cmd)

def deactivate_MPdev(sid):
if (mpp_luncheck.is_RdacLun(sid)):
pathlist = glob.glob('/dev/disk/mpInuse/%s-*' % sid)
path = pathlist[0]
else:
path = os.path.join(MP_INUSEDIR, sid)
path = os.path.join(MP_INUSEDIR, sid)
if os.path.exists(path):
os.unlink(path)

def reset(sid,explicit_unmap=False,delete_nodes=False):
util.SMlog("Resetting LUN %s" % sid)
if (mpp_luncheck.is_RdacLun(sid)):
_resetMPP(sid,explicit_unmap)
else:
_resetDMP(sid,explicit_unmap,delete_nodes)

def _resetMPP(sid,explicit_unmap):
deactivate_MPdev(sid)
return
_resetDMP(sid,explicit_unmap,delete_nodes)

def _delete_node(dev):
try:
Expand Down Expand Up @@ -200,10 +174,7 @@ def refresh(sid,npaths):
scsiutil.rescan(scsiutil._genHostList(""))
if not util.wait_for_path(path,60):
raise xs_errors.XenError('Device not appeared yet')
if not (mpp_luncheck.is_RdacLun(sid)):
_refresh_DMP(sid,npaths)
else:
_refresh_MPP(sid,npaths)
_refresh_DMP(sid,npaths)
else:
raise xs_errors.XenError('MPath not written yet')

Expand Down Expand Up @@ -273,13 +244,6 @@ def _refresh_DMP(sid, npaths):
util.wait_for_path(lvm_path, 10)
activate_MPdev(sid, path)

def _refresh_MPP(sid, npaths):
path = os.path.join(DEVBYMPPPATH,"%s" % sid)
mpppath = glob.glob(path)
if not len(mpppath):
raise xs_errors.XenError('MPP RDAC activate failed to detect mpp path')
activate_MPdev(sid,mpppath[0])

def activate():
util.SMlog("MPATH: multipath activate called")
cmd = ['ln', '-sf', iscsi_mpath_file, iscsi_file]
Expand All @@ -296,11 +260,6 @@ def activate():
if iscsilib.is_iscsi_daemon_running():
if not iscsilib._checkAnyTGT():
iscsilib.restart_daemon()

# Start the updatempppathd daemon
if not _is_mpp_daemon_running():
cmd = ["service", "updatempppathd", "start"]
util.pread2(cmd)

if not _is_mpath_daemon_running():
util.SMlog("Warning: multipath daemon not running. Starting daemon!")
Expand All @@ -323,11 +282,6 @@ def deactivate():
# Only do this if using our customized open-iscsi package
util.pread2(cmd)

# Stop the updatempppathd daemon
if _is_mpp_daemon_running():
cmd = ["service", "updatempppathd", "stop"]
util.pread2(cmd)

if _is_mpath_daemon_running():
# Flush the multipath nodes
for sid in mpath_cli.list_maps():
Expand All @@ -351,16 +305,7 @@ def deactivate():

def path(SCSIid):
if _is_valid_multipath_device(SCSIid) and _is_mpath_daemon_running():
if (mpp_luncheck.is_RdacLun(SCSIid)):
pathlist = glob.glob('/dev/disk/mpInuse/%s-*' % SCSIid)
util.SMlog("pathlist is:")
util.SMlog(pathlist)
if len(pathlist):
path = pathlist[0]
else:
path = os.path.join(MP_INUSEDIR, SCSIid)
else:
path = os.path.join(MP_INUSEDIR, SCSIid)
path = os.path.join(MP_INUSEDIR, SCSIid)
return path
else:
return DEVBYIDPATH + "/scsi-" + SCSIid
Expand Down
22 changes: 3 additions & 19 deletions drivers/mpathcount.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import xs_errors
import lock
import mpath_cli
import mpp_luncheck
import mpp_mpathutil
import glob
import json
Expand Down Expand Up @@ -94,9 +93,6 @@ def _tostring(l):

def get_path_count(SCSIid, active=True):
count = 0
if (mpp_luncheck.is_RdacLun(SCSIid)):
(total_count, active_count) = mpp_mpathutil.get_pathinfo(SCSIid)
return (total_count, active_count)
lines = mpath_cli.get_topology(SCSIid)
for line in filter(match_dmpLUN,lines):
if not active:
Expand Down Expand Up @@ -125,20 +121,11 @@ def update_config(key, SCSIid, entry, remove, add, mpp_path_update = False):
add(key,str(entry))
return

rdaclun = False
if (mpp_luncheck.is_RdacLun(SCSIid)):
rdaclun = True
pathlist = glob.glob('/dev/disk/mpInuse/%s-*' % SCSIid)
path = pathlist[0]
else:
path = MP_INUSEDIR + "/" + SCSIid
path = MP_INUSEDIR + "/" + SCSIid
util.SMlog("MPATH: Updating entry for [%s], current: %s" % (SCSIid,entry))
if os.path.exists(path):
if rdaclun:
(total, count) = get_path_count(SCSIid)
else:
count = get_path_count(SCSIid)
total = get_path_count(SCSIid, active=False)
count = get_path_count(SCSIid)
total = get_path_count(SCSIid, active=False)
max = 0
if len(entry) != 0:
try:
Expand All @@ -154,9 +141,6 @@ def update_config(key, SCSIid, entry, remove, add, mpp_path_update = False):
if str(newentry) != entry:
remove('multipathed')
remove(key)
if rdaclun:
remove('MPPEnabled')
add('MPPEnabled','true')
add('multipathed','true')
add(key,str(newentry))
util.SMlog("MPATH: Set val: %s" % str(newentry))
Expand Down
58 changes: 0 additions & 58 deletions drivers/mpp_luncheck.py

This file was deleted.

0 comments on commit be0a528

Please sign in to comment.