Skip to content

Commit

Permalink
Merge pull request #81 from DeliZhangX/private/deliz/CA-329871
Browse files Browse the repository at this point in the history
CA-329871: Remove usage of xslib.py of sm
  • Loading branch information
DeliZhangX authored Nov 7, 2019
2 parents 0820962 + 4fed564 commit 9f5ff02
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: python
python:
- "2.6"
- "2.7"
# command to install dependencies
install:
- "pip install -r requirements.txt --use-mirrors"
- "pip install -r requirements.txt"
# command to run tests
script:
- "pylint --version"
Expand Down
5 changes: 3 additions & 2 deletions src/XenCert/StorageHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3155,7 +3155,7 @@ def FunctionalTests(self):
StorageHandlerUtil.DestroySR(self.session, sr_ref)
checkPoints += 1
except Exception, e:
Print(" - Failed to cleanup after CIFS functional tests, please delete the following manually: %s, %s, %s. Exception: %s" % (testfile, testdir, mountpoint, str(e)))
Print(" - Failed to cleanup after CIFS functional tests, please delete the following manually: %s, %s, %s(sr). Exception: %s" % (testfile, testdir, self.session.xenapi.SR.get_uuid(sr_ref), str(e)))

return (retVal, checkPoints, totalCheckPoints)

Expand Down Expand Up @@ -3464,5 +3464,6 @@ def GetStorageHandler(g_storage_conf):
return StorageHandlerCIFS(g_storage_conf)

if g_storage_conf["storage_type"] == "isl":
return StorageHandlerISL(g_storage_conf)
#return StorageHandlerISL(g_storage_conf)
pass
return None
7 changes: 3 additions & 4 deletions src/XenCert/blockunblockhbapaths-brocade
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@

import sys
sys.path.insert(0, "/opt/xensource/sm")
sys.path.insert(0, "/opt/xensource/sm/snapwatchd")
import util
import xslib
import xen.lowlevel.xs
import random
import os
from XenCertLog import XenCertPrint
Expand Down Expand Up @@ -70,8 +69,8 @@ for port in sampled_portlist:
elif op == 'unblock':
blockUnblockPort(False, ip, username, password, port)

xs_handle = xslib.get_xs_handle()
xslib.setval(xs_handle, '/xencert/block-unblock-over', '1')
xs_handle = xen.lowlevel.xs.xs()
xs_handle.write('', '/xencert/block-unblock-over', '1')
del xs_handle

if op == 'block':
Expand Down
7 changes: 3 additions & 4 deletions src/XenCert/blockunblockhbapaths-cisco
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
#
import sys
sys.path.insert(0, "/opt/xensource/sm")
sys.path.insert(0, "/opt/xensource/sm/snapwatchd")
import util
import xslib
import xen.lowlevel.xs
import random
import os
from XenCertLog import XenCertPrint
Expand Down Expand Up @@ -70,8 +69,8 @@ for port in sampled_portlist:
elif op == 'unblock':
blockUnblockPort(False, ip, username, password, port)

xs_handle = xslib.get_xs_handle()
xslib.setval(xs_handle, '/xencert/block-unblock-over', '1')
xs_handle = xen.lowlevel.xs.xs()
xs_handle.write('', '/xencert/block-unblock-over', '1')
del xs_handle

if op == 'block':
Expand Down
7 changes: 3 additions & 4 deletions src/XenCert/blockunblockhbapaths-qlogic
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
#
import sys
sys.path.insert(0, "/opt/xensource/sm")
sys.path.insert(0, "/opt/xensource/sm/snapwatchd")
import util
import xslib
import xen.lowlevel.xs
import random
import os
from XenCertLog import XenCertPrint
Expand Down Expand Up @@ -70,8 +69,8 @@ for port in sampled_portlist:
elif op == 'unblock':
blockUnblockPort(False, ip, username, password, port)

xs_handle = xslib.get_xs_handle()
xslib.setval(xs_handle, '/xencert/block-unblock-over', '1')
xs_handle = xen.lowlevel.xs.xs()
xs_handle.write('', '/xencert/block-unblock-over', '1')
del xs_handle

if op == 'block':
Expand Down
8 changes: 4 additions & 4 deletions src/XenCert/blockunblockiscsipaths
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
#
import sys
sys.path.insert(0, "/opt/xensource/sm")
sys.path.insert(0, "/opt/xensource/sm/snapwatchd")
import util
import xslib
import xen.lowlevel.xs
import random

def help():
Expand Down Expand Up @@ -70,9 +69,10 @@ for ip in newList:

paths = paths.strip(',')

xs_handle = xslib.get_xs_handle()
xslib.setval(xs_handle, '/xencert/block-unblock-over', '1')
xs_handle = xen.lowlevel.xs.xs()
xs_handle.write('', '/xencert/block-unblock-over', '1')
del xs_handle

if op == 'block':
sys.stdout.write(paths)
sys.exit(0)
11 changes: 5 additions & 6 deletions src/XenCert/blockunblockpaths
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

import sys
sys.path.insert(0, "/opt/xensource/sm")
sys.path.insert(0, "/opt/xensource/sm/snapwatchd")
import util
import xslib
import xen.lowlevel.xs
import os
import time
from XenCertLog import Print, XenCertPrint
Expand All @@ -42,9 +41,9 @@ if len(sys.argv) != 5 and len(sys.argv) != 1 :
help()

retVal = ''
xs_handle = xslib.get_xs_handle()
xslib.setval(xs_handle, '/xencert/block-unblock-over', '0')
block_unblock_over = xslib.getval(xs_handle, '/xencert/block-unblock-over')
xs_handle = xen.lowlevel.xs.xs()
xs_handle.write('', '/xencert/block-unblock-over', '0')
block_unblock_over = xs_handle.read('', '/xencert/block-unblock-over')
if len(sys.argv) == 5:
cmd = [sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]]
XenCertPrint('blockunblockpaths - now call %s and wait for block/unblock to finish.' % cmd)
Expand All @@ -58,7 +57,7 @@ elif len(sys.argv) == 1:

while block_unblock_over != '1':
time.sleep(1)
block_unblock_over = xslib.getval(xs_handle, '/xencert/block-unblock-over')
block_unblock_over = xs_handle.read('', '/xencert/block-unblock-over')

os.system('xenstore-rm /xencert')
del xs_handle
Expand Down
2 changes: 2 additions & 0 deletions tests/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ zope=no
# so shouldn't trigger E0201 when accessed (need zope=yes to be considered).
acquired-members=REQUEST,acl_users,aq_parent

ignored-modules=scsiutil,iscsilib,util,BaseISCSI,nfs,lvhdutil,lvutil,srmetadata,metadata,vhdutil,mpath_cli,mpath_dmp,xs_errors


# checks for
# * unused variables / imports
Expand Down

0 comments on commit 9f5ff02

Please sign in to comment.