Skip to content

Commit

Permalink
CA-136790: Ensure consistent behaviour of get_devices_by_SCSIid
Browse files Browse the repository at this point in the history
Dependant on the udev rules there may be a mapper device in by-scsid. This
commit ensures that that get_devices_by_SCSIid never returns the mapper-device.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>

(cherry picked from commit 68010a2)
Fixes CA-172756.
Imported-by: Pritha Srivastava <pritha.srivastava@citrix.com>

GitHub: closes #269
  • Loading branch information
Robert Breker authored and chandrikas committed Aug 5, 2015
1 parent b991784 commit a04cbb3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/scsiutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ def getdev(path):
return os.path.realpath(newpath).split('/')[-1]

def get_devices_by_SCSIid(SCSIid):
return os.listdir(os.path.join('/dev/disk/by-scsid', SCSIid))
devices = os.listdir(os.path.join('/dev/disk/by-scsid', SCSIid))
if 'mapper' in devices:
devices.remove('mapper')
return devices

def rawdev(dev):
return re.sub("[0-9]*$","",getdev(dev))
Expand Down

0 comments on commit a04cbb3

Please sign in to comment.