Skip to content

Commit 9f5ff02

Browse files
author
Deli Zhang
authored
Merge pull request #81 from DeliZhangX/private/deliz/CA-329871
CA-329871: Remove usage of xslib.py of sm
2 parents 0820962 + 4fed564 commit 9f5ff02

File tree

8 files changed

+25
-26
lines changed

8 files changed

+25
-26
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: python
22
python:
3-
- "2.6"
3+
- "2.7"
44
# command to install dependencies
55
install:
6-
- "pip install -r requirements.txt --use-mirrors"
6+
- "pip install -r requirements.txt"
77
# command to run tests
88
script:
99
- "pylint --version"

src/XenCert/StorageHandler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3155,7 +3155,7 @@ def FunctionalTests(self):
31553155
StorageHandlerUtil.DestroySR(self.session, sr_ref)
31563156
checkPoints += 1
31573157
except Exception, e:
3158-
Print(" - Failed to cleanup after CIFS functional tests, please delete the following manually: %s, %s, %s. Exception: %s" % (testfile, testdir, mountpoint, str(e)))
3158+
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)))
31593159

31603160
return (retVal, checkPoints, totalCheckPoints)
31613161

@@ -3464,5 +3464,6 @@ def GetStorageHandler(g_storage_conf):
34643464
return StorageHandlerCIFS(g_storage_conf)
34653465

34663466
if g_storage_conf["storage_type"] == "isl":
3467-
return StorageHandlerISL(g_storage_conf)
3467+
#return StorageHandlerISL(g_storage_conf)
3468+
pass
34683469
return None

src/XenCert/blockunblockhbapaths-brocade

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717

1818
import sys
1919
sys.path.insert(0, "/opt/xensource/sm")
20-
sys.path.insert(0, "/opt/xensource/sm/snapwatchd")
2120
import util
22-
import xslib
21+
import xen.lowlevel.xs
2322
import random
2423
import os
2524
from XenCertLog import XenCertPrint
@@ -70,8 +69,8 @@ for port in sampled_portlist:
7069
elif op == 'unblock':
7170
blockUnblockPort(False, ip, username, password, port)
7271

73-
xs_handle = xslib.get_xs_handle()
74-
xslib.setval(xs_handle, '/xencert/block-unblock-over', '1')
72+
xs_handle = xen.lowlevel.xs.xs()
73+
xs_handle.write('', '/xencert/block-unblock-over', '1')
7574
del xs_handle
7675

7776
if op == 'block':

src/XenCert/blockunblockhbapaths-cisco

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
#
1818
import sys
1919
sys.path.insert(0, "/opt/xensource/sm")
20-
sys.path.insert(0, "/opt/xensource/sm/snapwatchd")
2120
import util
22-
import xslib
21+
import xen.lowlevel.xs
2322
import random
2423
import os
2524
from XenCertLog import XenCertPrint
@@ -70,8 +69,8 @@ for port in sampled_portlist:
7069
elif op == 'unblock':
7170
blockUnblockPort(False, ip, username, password, port)
7271

73-
xs_handle = xslib.get_xs_handle()
74-
xslib.setval(xs_handle, '/xencert/block-unblock-over', '1')
72+
xs_handle = xen.lowlevel.xs.xs()
73+
xs_handle.write('', '/xencert/block-unblock-over', '1')
7574
del xs_handle
7675

7776
if op == 'block':

src/XenCert/blockunblockhbapaths-qlogic

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
#
1818
import sys
1919
sys.path.insert(0, "/opt/xensource/sm")
20-
sys.path.insert(0, "/opt/xensource/sm/snapwatchd")
2120
import util
22-
import xslib
21+
import xen.lowlevel.xs
2322
import random
2423
import os
2524
from XenCertLog import XenCertPrint
@@ -70,8 +69,8 @@ for port in sampled_portlist:
7069
elif op == 'unblock':
7170
blockUnblockPort(False, ip, username, password, port)
7271

73-
xs_handle = xslib.get_xs_handle()
74-
xslib.setval(xs_handle, '/xencert/block-unblock-over', '1')
72+
xs_handle = xen.lowlevel.xs.xs()
73+
xs_handle.write('', '/xencert/block-unblock-over', '1')
7574
del xs_handle
7675

7776
if op == 'block':

src/XenCert/blockunblockiscsipaths

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
#
1818
import sys
1919
sys.path.insert(0, "/opt/xensource/sm")
20-
sys.path.insert(0, "/opt/xensource/sm/snapwatchd")
2120
import util
22-
import xslib
21+
import xen.lowlevel.xs
2322
import random
2423

2524
def help():
@@ -70,9 +69,10 @@ for ip in newList:
7069

7170
paths = paths.strip(',')
7271

73-
xs_handle = xslib.get_xs_handle()
74-
xslib.setval(xs_handle, '/xencert/block-unblock-over', '1')
72+
xs_handle = xen.lowlevel.xs.xs()
73+
xs_handle.write('', '/xencert/block-unblock-over', '1')
7574
del xs_handle
75+
7676
if op == 'block':
7777
sys.stdout.write(paths)
7878
sys.exit(0)

src/XenCert/blockunblockpaths

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424

2525
import sys
2626
sys.path.insert(0, "/opt/xensource/sm")
27-
sys.path.insert(0, "/opt/xensource/sm/snapwatchd")
2827
import util
29-
import xslib
28+
import xen.lowlevel.xs
3029
import os
3130
import time
3231
from XenCertLog import Print, XenCertPrint
@@ -42,9 +41,9 @@ if len(sys.argv) != 5 and len(sys.argv) != 1 :
4241
help()
4342

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

5958
while block_unblock_over != '1':
6059
time.sleep(1)
61-
block_unblock_over = xslib.getval(xs_handle, '/xencert/block-unblock-over')
60+
block_unblock_over = xs_handle.read('', '/xencert/block-unblock-over')
6261

6362
os.system('xenstore-rm /xencert')
6463
del xs_handle

tests/pylintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ zope=no
122122
# so shouldn't trigger E0201 when accessed (need zope=yes to be considered).
123123
acquired-members=REQUEST,acl_users,aq_parent
124124

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

126128
# checks for
127129
# * unused variables / imports

0 commit comments

Comments
 (0)