From be0a5283a7c494f1b34ff72ce11f9da4ccb947e5 Mon Sep 17 00:00:00 2001 From: Mark Syms Date: Thu, 7 Feb 2019 16:46:38 +0000 Subject: [PATCH] Remove code conditional on mpp_luncheck.is_RdacLun which has only ever returned False for some time Signed-off-by: Mark Syms --- Makefile | 4 - drivers/LVHDoHBASR.py | 11 +-- drivers/LVHDoISCSISR.py | 23 +----- drivers/OCFSoISCSISR.py | 8 -- drivers/mpath_dmp.py | 65 ++------------- drivers/mpathcount.py | 22 +---- drivers/mpp_luncheck.py | 58 -------------- drivers/updatempppathd.py | 142 --------------------------------- drivers/updatempppathd.service | 10 --- mk/sm.spec.in | 42 +++++----- tests/test_mpath_dmp.py | 8 +- 11 files changed, 33 insertions(+), 360 deletions(-) delete mode 100755 drivers/mpp_luncheck.py delete mode 100755 drivers/updatempppathd.py delete mode 100644 drivers/updatempppathd.service diff --git a/Makefile b/Makefile index 259c21d56..677e6f74c 100755 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 \ diff --git a/drivers/LVHDoHBASR.py b/drivers/LVHDoHBASR.py index f9df64822..687fa5815 100755 --- a/drivers/LVHDoHBASR.py +++ b/drivers/LVHDoHBASR.py @@ -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", @@ -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) diff --git a/drivers/LVHDoISCSISR.py b/drivers/LVHDoISCSISR.py index 994d8e26c..fdbcbaef0 100755 --- a/drivers/LVHDoISCSISR.py +++ b/drivers/LVHDoISCSISR.py @@ -25,7 +25,6 @@ import xmlrpclib import mpath_cli, iscsilib import glob, copy -import mpp_luncheck import scsiutil import xml.dom.minidom @@ -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 @@ -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): diff --git a/drivers/OCFSoISCSISR.py b/drivers/OCFSoISCSISR.py index 29cfb2daf..f48495ef4 100755 --- a/drivers/OCFSoISCSISR.py +++ b/drivers/OCFSoISCSISR.py @@ -25,7 +25,6 @@ import xmlrpclib import mpath_cli, iscsilib import glob, copy -import mpp_luncheck import scsiutil import xml.dom.minidom @@ -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 diff --git a/drivers/mpath_dmp.py b/drivers/mpath_dmp.py index 4dd6e8dad..b8a276718 100755 --- a/drivers/mpath_dmp.py +++ b/drivers/mpath_dmp.py @@ -23,7 +23,6 @@ import glob import time import scsiutil -import mpp_luncheck import wwid_conf import errno @@ -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" @@ -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) @@ -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: @@ -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') @@ -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] @@ -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!") @@ -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(): @@ -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 diff --git a/drivers/mpathcount.py b/drivers/mpathcount.py index c55b9b225..b29e6a96e 100755 --- a/drivers/mpathcount.py +++ b/drivers/mpathcount.py @@ -20,7 +20,6 @@ import xs_errors import lock import mpath_cli -import mpp_luncheck import mpp_mpathutil import glob import json @@ -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: @@ -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: @@ -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)) diff --git a/drivers/mpp_luncheck.py b/drivers/mpp_luncheck.py deleted file mode 100755 index 5f8cd5414..000000000 --- a/drivers/mpp_luncheck.py +++ /dev/null @@ -1,58 +0,0 @@ -#! /usr/bin/env python -# -# Copyright (C) Citrix Systems Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation; version 2.1 only. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -import sys, os -import glob -import util - -DEVBYMPPPATH = "/dev/disk/by-mpp" -def is_RdacLun(scsi_id): - path = os.path.join(DEVBYMPPPATH,"%s" % scsi_id) - mpppath = glob.glob(path) - if len(mpppath): - # Support for RDAC LUNs discontinued - # Always return False - util.SMlog("Found unsupported RDAC LUN at %s" % mpppath, - priority=util.LOG_WARNING) - return False - else: - return False - -def usage(): - print "Usage:"; - print "%s is_rdaclun " % sys.argv[0] - -def main(): - if len(sys.argv) < 3: - usage() - sys.exit(-1) - - scsi_id = sys.argv[2] - mode = sys.argv[1] - - if mode == "is_rdaclun": - if (is_RdacLun(scsi_id)): - print "It is a RDAC Lun" - return True - else: - print "It is not a RDAC Lun" - return False - else: - usage() - sys.exit(-1) -if __name__ == "__main__": - main() diff --git a/drivers/updatempppathd.py b/drivers/updatempppathd.py deleted file mode 100755 index 030288b57..000000000 --- a/drivers/updatempppathd.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (C) Citrix Systems Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation; version 2.1 only. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# -# MPP LUNs path status update daemon - -import sys -import os -import util -import glob -import time -import mpp_mpathutil -import gc -import mpp_luncheck - -DEBUG_OUT = False -DAEMONISE = True -VERSION = "v1.0.1" -MPP_PATH_STATUS_UPDATE_INTERVAL = 60 -MPP_DEVICES_IN_USE_LOCATION = "/dev/disk/mpInuse" -MPP_PATH_KEY_PREFIX = "mpath-" -MPP_PATH_CACHE_LOCATION = "/tmp" - -def help(): - print "updatempppathd version %s:\n" % VERSION - print "Usage: updatempppathd -f : run in foreground" - print " -d : send debug output to SMlog" - sys.exit(-1) - -def DEBUG(str): - if DEBUG_OUT: - util.SMlog(str, ident="updatempppathd", priority=util.LOG_DEBUG) - -# Main update paths routine -def UpdatePaths(): - - while(True): - try: - session = None - # Garbage collect any memory allocated in the last run of the loop - DEBUG("The garbage collection routine returned: %d" % gc.collect()) - - # Sleep for some time before checking the status again - time.sleep(MPP_PATH_STATUS_UPDATE_INTERVAL); - - # List the contents of the directory /dev/disk/mpInuse - fileList = glob.glob(MPP_DEVICES_IN_USE_LOCATION + "/" + "*"); - if not len(fileList): - continue - - # for each SCSI ID get the cached values of the total paths and active paths - # and then compare this with the current path status obtained using mpp_mpathutil.py - for filename in fileList: - # extract the SCSI ID from the file name. - scsiid = filename.rsplit("/")[len(filename.rsplit("/")) - 1].split('-')[0] - if not (mpp_luncheck.is_RdacLun(scsiid)): - continue - - # Get the cached value for the total and active paths for this SCSI ID - try: - cacheFile = glob.glob(MPP_PATH_CACHE_LOCATION + "/" + scsiid + "*"); - if len(cacheFile) > 1: - DEBUG("More than one cache file found for SCSI ID %s. Please check the cache manually.") - raise Exception - - # This will return only one file name of the form SCSIID:TOTALPATHS:ACTIVEPATHS, so parse accordingly - cachedTotalPaths = cacheFile[0].split(":")[1]; - cachedActivePaths = cacheFile[0].split(":")[2]; - cacheFileFound = True - except: - DEBUG("There was an exception getting the cached path status for SCSI ID %s, assuming 0s." % scsiid) - cachedTotalPaths = 0 - cachedActivePaths = 0 - cacheFileFound = False - - (totalPaths, activePaths) = mpp_mpathutil.get_pathinfo(scsiid) - - DEBUG("For SCSI ID %s, cached TotalPaths: %s, cached ActivePaths: %s, New Totalpaths: %s New ActivePaths: %s" % (scsiid, cachedTotalPaths, cachedActivePaths, totalPaths, activePaths)) - - if cachedTotalPaths != str(totalPaths) or cachedActivePaths != str(activePaths): - DEBUG("Some path status has changed for SCSI ID %s, updating PBD." % scsiid) - entry = "[" + str(activePaths) + ", " + str(totalPaths) + "]" - DEBUG(entry) - cmd = ['/opt/xensource/sm/mpathcount.py', scsiid, entry] - util.pread2(cmd) - - # Now update the cache with this updated path status - DEBUG("Checking if cache file was found.") - if cacheFileFound == True: - DEBUG("Cache file was found, delete it.") - os.remove(cacheFile[0]) - cacheFileName = MPP_PATH_CACHE_LOCATION + "/" + scsiid + ":" + str(totalPaths) + ":" + str(activePaths) - DEBUG("Generated new cache file name %s" % cacheFileName) - open(cacheFileName, 'w').close() - - except: - pass - #DEBUG("There was some exception while updating path status for the SCSI ID %s." % scsiid ) - #break - - if session != None: - session.xenapi.session.logout() - - return - -# Test Cmdline args -if len(sys.argv) > 1: - for i in range(1,len(sys.argv)): - if sys.argv[i] == "-f": - DAEMONISE = False - elif sys.argv[i] == "-d": - DEBUG_OUT = True - try: - DEBUG("UPDATEMPPPATHD - Daemon started (%s)" % VERSION) - except: - print "Logging failed" - help() - -# Daemonize -if DAEMONISE: - util.daemon() - -try: - UpdatePaths(); - -except: - pass - -DEBUG("UPDATEMPPPATHD - Daemon halted") diff --git a/drivers/updatempppathd.service b/drivers/updatempppathd.service deleted file mode 100644 index 190c8508e..000000000 --- a/drivers/updatempppathd.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Daemon to update all MPP LUN paths -After=syslog.target network.target - -[Service] -Type=simple -ExecStart=/opt/xensource/sm/updatempppathd.py -f - -[Install] -WantedBy=multi-user.target diff --git a/mk/sm.spec.in b/mk/sm.spec.in index 007afaba7..67e54338c 100755 --- a/mk/sm.spec.in +++ b/mk/sm.spec.in @@ -9,18 +9,20 @@ License: LGPL URL: http://www.citrix.com Source0: sm-@SM_VERSION@.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-root -BuildRequires: python-devel xen-devel systemd +BuildRequires: python-devel xen-devel systemd pylint python-nose python-coverage python2-mock python2-bitarray Requires(post): systemd Requires(preun): systemd Requires(postun): systemd Requires: xenserver-multipath -Requires: xenserver-lvm2 +Requires: xenserver-lvm2 >= 2.02.177 +Requires: python2-bitarray +Conflicts: kernel < 4.19.19-5.0.0 %description This package contains storage backends used in XCP %prep -%setup -q +%autosetup -p1 %build DESTDIR=$RPM_BUILD_ROOT make @@ -36,19 +38,20 @@ rm -rf $RPM_BUILD_ROOT [ ! -x /sbin/chkconfig ] || chkconfig --add sm-multipath service sm-multipath start %systemd_post make-dummy-sr.service +%systemd_post mpcount.service %systemd_post snapwatchd.service -%systemd_post updatempppathd.service -%systemd_post usb-scan.service +%systemd_post xs-sm.service %systemd_post usb-scan.socket -%systemd_post mpathcount.service %systemd_post mpathcount.socket +/bin/systemctl enable xs-sm.service >/dev/null 2>&1 || : +/bin/systemctl enable usb-scan.socket >/dev/null 2>&1 || : +/bin/systemctl enable mpathcount.socket >/dev/null 2>&1 || : [ -f /etc/lvm/lvm.conf.orig ] || cp /etc/lvm/lvm.conf /etc/lvm/lvm.conf.orig || exit $? [ -d /etc/lvm/master ] || mkdir /etc/lvm/master || exit $? mv -f /etc/lvm/lvm.conf /etc/lvm/master/lvm.conf || exit $? sed -i 's/metadata_read_only =.*/metadata_read_only = 0/' /etc/lvm/master/lvm.conf || exit $? sed -i 's/archive = .*/archive = 0/' /etc/lvm/master/lvm.conf || exit $? -sed -i 's/use_lvmetad = 1/use_lvmetad = 0/' /etc/lvm/master/lvm.conf || exit $? sed -i 's/udev_sync = 1/udev_sync = 0/' /etc/lvm/master/lvm.conf || exit $? sed -i 's/udev_rules = 1/udev_rules = 0/' /etc/lvm/master/lvm.conf || exit $? sed -i 's/obtain_device_list_from_udev = 1/obtain_device_list_from_udev = 0/' /etc/lvm/master/lvm.conf || exit $? @@ -57,7 +60,6 @@ cp /etc/lvm/master/lvm.conf /etc/lvm/lvm.conf || exit $? sed -i 's/metadata_read_only =.*/metadata_read_only = 1/' /etc/lvm/lvm.conf || exit $? rm -f /etc/lvm/cache/.cache touch /etc/lvm/cache/.cache -mv /usr/sbin/lvmetad /usr/sbin/lvmetad_ # We try to be "update-alternatives" ready. # If a file exists and it is not a symlink we back it up @@ -68,11 +70,10 @@ update-alternatives --install /etc/multipath.conf multipath.conf /etc/multipath. %preun %systemd_preun make-dummy-sr.service +%systemd_preun mpcount.service %systemd_preun snapwatchd.service -%systemd_preun updatempppathd.service -%systemd_preun usb-scan.service +%systemd_preun xs-sm.service %systemd_preun usb-scan.socket -%systemd_preun mpathcount.service %systemd_preun mpathcount.socket #only remove in case of erase (but not at upgrade) if [ $1 -eq 0 ] ; then @@ -83,14 +84,14 @@ exit 0 %postun %systemd_postun make-dummy-sr.service +%systemd_postun mpcount.service %systemd_postun_with_restart snapwatchd.service -%systemd_postun updatempppathd.service +%systemd_postun xs-sm.service if [ $1 -eq 0 ]; then [ ! -d /etc/lvm/master ] || rm -Rf /etc/lvm/master || exit $? cp -f /etc/lvm/lvm.conf.orig /etc/lvm/lvm.conf || exit $? - mv /usr/sbin/lvmetad_ /usr/sbin/lvmetad elif [ $1 -eq 1 ]; then - true; + true; fi %posttrans @@ -124,8 +125,8 @@ tests/run_python_unittests.sh /opt/xensource/libexec/dcopy /opt/xensource/libexec/local-device-change /opt/xensource/libexec/make-dummy-sr -/opt/xensource/libexec/kickpipe /opt/xensource/libexec/usb_change +/opt/xensource/libexec/kickpipe /opt/xensource/sm/DummySR /opt/xensource/sm/DummySR.py /opt/xensource/sm/DummySR.pyc @@ -268,9 +269,6 @@ tests/run_python_unittests.sh /opt/xensource/sm/mpathutil.py /opt/xensource/sm/mpathutil.pyc /opt/xensource/sm/mpathutil.pyo -/opt/xensource/sm/mpp_luncheck.py -/opt/xensource/sm/mpp_luncheck.pyc -/opt/xensource/sm/mpp_luncheck.pyo /opt/xensource/sm/mpp_mpathutil.py /opt/xensource/sm/mpp_mpathutil.pyc /opt/xensource/sm/mpp_mpathutil.pyo @@ -303,9 +301,6 @@ tests/run_python_unittests.sh /opt/xensource/sm/udevSR.py /opt/xensource/sm/udevSR.pyc /opt/xensource/sm/udevSR.pyo -/opt/xensource/sm/updatempppathd.py -/opt/xensource/sm/updatempppathd.pyc -/opt/xensource/sm/updatempppathd.pyo /opt/xensource/sm/util.py /opt/xensource/sm/util.pyc /opt/xensource/sm/util.pyo @@ -338,7 +333,7 @@ tests/run_python_unittests.sh /etc/rc.d/init.d/sm-multipath %{_unitdir}/make-dummy-sr.service %{_unitdir}/snapwatchd.service -%{_unitdir}/updatempppathd.service +%{_unitdir}/xs-sm.service %{_unitdir}/usb-scan.service %{_unitdir}/usb-scan.socket %{_unitdir}/mpathcount.service @@ -349,7 +344,8 @@ tests/run_python_unittests.sh %config /etc/multipath.xenserver/multipath.conf %config /etc/udev/rules.d/69-dm-lvm-metad.rules %config /etc/logrotate.d/SMlog -%doc CONTRIB LICENSE MAINTAINERS README.md WHATS_NEW +%config /etc/udev/rules.d/57-usb.rules +%doc CONTRIB LICENSE MAINTAINERS README.md %changelog diff --git a/tests/test_mpath_dmp.py b/tests/test_mpath_dmp.py index 09803c9ad..1c0b6bebb 100644 --- a/tests/test_mpath_dmp.py +++ b/tests/test_mpath_dmp.py @@ -73,26 +73,22 @@ def test_is_valid_multipath_device(self, context, mock_os, util_mod): (0, "out", "err")] self.assertTrue(mpath_dmp._is_valid_multipath_device("fake_dev")) - @mock.patch('mpath_dmp.mpp_luncheck.is_RdacLun', autospec=True) @mock.patch('util.pread2', autospec=True) @mock.patch('mpath_dmp.os.mkdir', autospec=True) - def test_activate_no_exception(self, mock_mkdir, pread2, is_rdaclun): + def test_activate_no_exception(self, mock_mkdir, pread2): """ Test that activeate MPDev works if directory does not exist """ - is_rdaclun.return_value = False mpath_dmp.activate_MPdev("sid", "dst") pread2.assert_called_with(['ln', '-sf', "dst", os.path.join(mpath_dmp.MP_INUSEDIR, "sid")]) - @mock.patch('mpath_dmp.mpp_luncheck.is_RdacLun', autospec=True) @mock.patch('util.pread2', autospec=True) @mock.patch('mpath_dmp.os.mkdir', autospec=True) - def test_activate_exists_success(self, mock_mkdir, pread2, is_rdaclun): + def test_activate_exists_success(self, mock_mkdir, pread2): """ Test that activeate MPDev works if directory exists """ mock_mkdir.side_effect = [OSError(errno.EEXIST, "Directory exists")] - is_rdaclun.return_value = False mpath_dmp.activate_MPdev("sid", "dst") pread2.assert_called_with(['ln', '-sf', "dst", os.path.join(mpath_dmp.MP_INUSEDIR, "sid")])