Skip to content

Commit

Permalink
Use a safer method to get a dm partition's disk name.
Browse files Browse the repository at this point in the history
Resolves: rhbz#1190886
Related: rhbz#1181336
  • Loading branch information
dwlehman committed May 29, 2015
1 parent 03222fe commit d1d6ccb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion blivet/udev.py
Expand Up @@ -526,7 +526,19 @@ def device_is_biosraid_member(info):
return False

def device_get_dm_partition_disk(info):
return re.sub(r'p?\d*$', '', device_get_name(info))
if not device_is_dm_partition(info):
return None

disk = None
majorminor = info.get("ID_PART_ENTRY_DISK")
if majorminor:
major, minor = majorminor.split(":")
for device in get_devices():
if device.get("MAJOR") == major and device.get("MINOR") == minor:
disk = device_get_name(device)
break

return disk

def device_is_dm_partition(info):
return (device_is_dm(info) and
Expand Down

0 comments on commit d1d6ccb

Please sign in to comment.