Skip to content

Commit

Permalink
adds the util.disk.is_mapper_device method
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
(cherry picked from commit 852a466)
  • Loading branch information
andrewschoen committed Jul 26, 2018
1 parent 117946d commit ce0bbc6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ceph-volume/ceph_volume/util/disk.py
Expand Up @@ -356,6 +356,10 @@ def get_partitions_facts(sys_block_path):
return partition_metadata


def is_mapper_device(device_name):
return device_name.startswith(('/dev/mapper', '/dev/dm-'))


def get_devices(_sys_block_path='/sys/block', _dev_path='/dev', _mapper_path='/dev/mapper'):
"""
Captures all available devices from /sys/block/, including its partitions,
Expand Down Expand Up @@ -391,7 +395,7 @@ def get_devices(_sys_block_path='/sys/block', _dev_path='/dev', _mapper_path='/d
diskname = mapper_devs.get(block) or dev_devs.get(block)

# If the mapper device is a logical volume it gets excluded
if diskname.startswith(('/dev/mapper', '/dev/dm-')):
if is_mapper_device(diskname):
if lvm.is_lv(diskname):
continue

Expand Down

0 comments on commit ce0bbc6

Please sign in to comment.