From 7e2a342b70bd8c6a4e7c5ade3f4a0093db20cea0 Mon Sep 17 00:00:00 2001 From: Qin Zhang Date: Fri, 1 Sep 2023 06:45:01 +0000 Subject: [PATCH] Remove unused scripts and code Signed-off-by: Qin Zhang --- Makefile | 2 -- drivers/scsiutil.py | 10 ---------- drivers/util.py | 22 ++++++---------------- mk/sm.spec.in | 2 -- scripts/xe-getarrayidentifier | 21 --------------------- scripts/xe-getlunidentifier | 22 ---------------------- 6 files changed, 6 insertions(+), 73 deletions(-) delete mode 100755 scripts/xe-getarrayidentifier delete mode 100755 scripts/xe-getlunidentifier diff --git a/Makefile b/Makefile index 3e06e515..1583a03d 100755 --- a/Makefile +++ b/Makefile @@ -212,8 +212,6 @@ install: precheck ln -sf $(SM_DEST)lcache.py $(SM_STAGING)$(BIN_DEST)tapdisk-cache-stats ln -sf /dev/null $(SM_STAGING)$(UDEV_RULES_DIR)/69-dm-lvm-metad.rules install -m 755 scripts/xs-mpath-scsidev.sh $(SM_STAGING)$(UDEV_SCRIPTS_DIR) - install -m 755 scripts/xe-getarrayidentifier $(SM_STAGING)$(BIN_DEST) - install -m 755 scripts/xe-getlunidentifier $(SM_STAGING)$(BIN_DEST) install -m 755 scripts/make-dummy-sr $(SM_STAGING)$(LIBEXEC) install -m 755 scripts/storage-init $(SM_STAGING)$(LIBEXEC) diff --git a/drivers/scsiutil.py b/drivers/scsiutil.py index b2ff0f90..0138a09b 100755 --- a/drivers/scsiutil.py +++ b/drivers/scsiutil.py @@ -357,16 +357,6 @@ def rescan(ids, fullrescan=True): refresh_HostID(id, fullrescan) -def _genArrayIdentifier(dev): - try: - cmd = ["sg_inq", "--page=0xc8", "-r", dev] - id = util.pread2(cmd) - #pylint: disable=no-member - return id.encode("hex")[180:212] - except: - return "" - - def _genHostList(procname): # loop through and check all adapters ids = [] diff --git a/drivers/util.py b/drivers/util.py index 1e13f79c..eb7698b2 100755 --- a/drivers/util.py +++ b/drivers/util.py @@ -1232,16 +1232,6 @@ def daemon(): os.open('/dev/null', os.O_RDWR) os.dup2(0, 1) os.dup2(0, 2) -######################### - -if __debug__: - try: - #pylint: disable=used-before-assignment - XE_IOFI_IORETRY - except NameError: - XE_IOFI_IORETRY = os.environ.get('XE_IOFI_IORETRY', None) - if __name__ == 'util' and XE_IOFI_IORETRY is not None: - __import__('iofi') ################################################################################ # @@ -1777,7 +1767,7 @@ def hideValuesInPropMap(propmap, propnames): def hidePasswdInConfig(config): """ - Function to hide passwd values in a simple prop map, + Function to hide passwd values in a simple prop map, for example "device_config" """ return hideValuesInPropMap(config, PASSWD_PROP_KEYS) @@ -1785,10 +1775,10 @@ def hidePasswdInConfig(config): def hidePasswdInParams(params, configProp): """ - Function to hide password values in a specified property which + Function to hide password values in a specified property which is a simple map of prop name/values, and is itself an prop entry in a larger property map. - For example, param maps containing "device_config", or + For example, param maps containing "device_config", or "sm_config", etc """ params[configProp] = hideValuesInPropMap(params[configProp], PASSWD_PROP_KEYS) @@ -1797,11 +1787,11 @@ def hidePasswdInParams(params, configProp): def hideMemberValuesInXmlParams(xmlParams, propnames=PASSWD_PROP_KEYS): """ - Function to hide password values in XML params, specifically + Function to hide password values in XML params, specifically for the XML format of incoming params to SR modules. - Uses text parsing: loop through the list of specific propnames + Uses text parsing: loop through the list of specific propnames whose values we want to hide, and: - - Assemble a full "prefix" containing each property name, e.g., + - Assemble a full "prefix" containing each property name, e.g., "password" - Test the XML if it contains that string, save the index. - If found, get the index of the ending tag diff --git a/mk/sm.spec.in b/mk/sm.spec.in index 119e22b4..33457d0a 100755 --- a/mk/sm.spec.in +++ b/mk/sm.spec.in @@ -118,8 +118,6 @@ tests/run_python_unittests.sh /etc/xensource/master.d/02-vhdcleanup /opt/xensource/bin/blktap2 /opt/xensource/bin/tapdisk-cache-stats -/opt/xensource/bin/xe-getarrayidentifier -/opt/xensource/bin/xe-getlunidentifier /opt/xensource/debug/tp /opt/xensource/libexec/check-device-sharing /opt/xensource/libexec/dcopy diff --git a/scripts/xe-getarrayidentifier b/scripts/xe-getarrayidentifier deleted file mode 100755 index bef1843e..00000000 --- a/scripts/xe-getarrayidentifier +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/python3 - -import sys -import os -import subprocess -import base64 - -def doexec(args, inputtext=None): - """Execute a subprocess, then return its return code, stdout and stderr""" - proc = subprocess.Popen(args,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,close_fds=True) - (stdout,stderr) = proc.communicate(inputtext) - rc = proc.returncode - return (rc,stdout,stderr) - -try: - cmd = ["/usr/bin/sg_inq", "--page=0xc8", "-r", sys.argv[1]] - (rc, stdout, stderr) = doexec(cmd) - if rc == 0: - print stdout.encode("hex")[180:212] -except: - sys.exit(1) diff --git a/scripts/xe-getlunidentifier b/scripts/xe-getlunidentifier deleted file mode 100755 index d50891e0..00000000 --- a/scripts/xe-getlunidentifier +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/python3 - -import sys -import os -import subprocess -import base64 - -def doexec(args, inputtext=None): - """Execute a subprocess, then return its return code, stdout and stderr""" - proc = subprocess.Popen(args,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,close_fds=True) - (stdout,stderr) = proc.communicate(inputtext) - rc = proc.returncode - return (rc,stdout,stderr) - -try: - cmd = ["/usr/bin/sg_inq", "--page=0xc8", "-r", sys.argv[1]] - (rc, stdout, stderr) = doexec(cmd) - if rc == 0: - len = int(stdout.encode("hex")[22:24], 16) - print stdout.encode("hex")[24:(24 + (len * 2))] -except: - sys.exit(1)