From 841e50fbd7fad412b4b00e7adfc3c3cbfa1e96c2 Mon Sep 17 00:00:00 2001 From: Letsibogo Ramadi Date: Thu, 11 Aug 2016 16:38:24 +0000 Subject: [PATCH] CA-210336: Added exception handling to prevent stack trace dump Added exception handling for when devices path is not valid. Signed-off-by: Letsibogo Ramadi --- drivers/BaseISCSI.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/BaseISCSI.py b/drivers/BaseISCSI.py index e6e7a44ad..7f5ef038c 100755 --- a/drivers/BaseISCSI.py +++ b/drivers/BaseISCSI.py @@ -350,7 +350,17 @@ 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 = os.listdir( + os.path.join('/dev/disk/by-scsid', self.dconf['SCSIid']) + ) + except OSError as e: + util.SMlog(str(e)) + 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")