Skip to content

Commit

Permalink
CA-210336: Added exception handling to prevent stack trace dump
Browse files Browse the repository at this point in the history
Added a try-except block around line 353 which lists devices
at a given path in BaseISCSI.py attach method. Also made change
in SRCommand.py to prevent raising exceptions that are not of
type SR.SRException and dumping the stack trace on command line.

Signed-off-by: Letsibogo Ramadi <letsibogo.ramadi@citrix.com>
  • Loading branch information
letsboogey committed Aug 12, 2016
1 parent 4a4c5b4 commit 5df738f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion drivers/BaseISCSI.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,14 @@ def attach(self, sr_uuid):
if self.dconf.has_key('SCSIid'):
if self.mpath == 'true':
self.mpathmodule.refresh(self.dconf['SCSIid'], 0)
devs = os.listdir("/dev/disk/by-scsid/%s" % self.dconf['SCSIid'])
try:
devs_path = "/dev/disk/by-scsid/%s" % self.dconf['SCSIid']
devs = os.listdir(devs_path)
except:
util.SMlog("[Errno 2] No such file or directory: '%s'" % devs_path)
raise xs_errors.XenError('ConfigDeviceInvalid',
opterr='check devices path')

for dev in devs:
realdev = os.path.realpath("/dev/disk/by-scsid/%s/%s" % (self.dconf['SCSIid'], dev))
util.set_scheduler(realdev.split("/")[-1], "noop")
Expand Down
2 changes: 1 addition & 1 deletion drivers/SRCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,6 @@ def run(driver, driver_info):
if isinstance(e, SR.SRException):
print e.toxml()
else:
raise
sys.exit(1)

sys.exit(0)

0 comments on commit 5df738f

Please sign in to comment.