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.

Signed-off-by: Letsibogo Ramadi <[email protected]>
  • Loading branch information
letsboogey committed Aug 16, 2016
1 parent 4a4c5b4 commit 3be0ab0
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 3be0ab0

Please sign in to comment.