summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormulhern <amulhern@redhat.com>2016-01-08 15:48:35 -0500
committermulhern <amulhern@redhat.com>2016-01-08 15:48:35 -0500
commitc4d26669558674805620f96e070939cca964ab09 (patch)
tree95f778edc36e8ac413461540bcba6cbf9832af29
parentf17b77d47def7141e10a740d04b721d3d9f97b05 (diff)
downloadrtslib-fb-c4d26669558674805620f96e070939cca964ab09.tar.gz
Use find_parent instead of parent.
Better, because it is sure to find the scsi parent. You never know what intermediate parent might get interposed. Better, becaus it does not rely on subsystem property (which sometimes raises an AttributeError (fixed in pyudev 0.19)). Signed-off-by: mulhern <amulhern@redhat.com>
-rw-r--r--rtslib/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/rtslib/utils.py b/rtslib/utils.py
index e5f1c4d..a763bcc 100644
--- a/rtslib/utils.py
+++ b/rtslib/utils.py
@@ -231,8 +231,8 @@ def _hctl_from_dev(device):
@returns: H:C:T:L specifier or None if not found
@rtype: list of int * 4 or NoneType
'''
- parent = device.parent
- if parent is None or parent.subsystem != 'scsi':
+ parent = device.find_parent(subsystem='scsi')
+ if parent is None:
return None
try: