From: Andrew Schoen Date: Thu, 28 Jun 2018 17:14:12 +0000 (-0500) Subject: adds the util.disk.is_mapper_device method X-Git-Tag: v12.2.8~65^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4dbd220cbf2e001979542897db296315a1e430e5;p=ceph.git adds the util.disk.is_mapper_device method Signed-off-by: Andrew Schoen (cherry picked from commit 852a466fdfa29c91f266ec122dcd5b01b8d1fca5) --- diff --git a/src/ceph-volume/ceph_volume/util/disk.py b/src/ceph-volume/ceph_volume/util/disk.py index 21b12d475b313..256947d363258 100644 --- a/src/ceph-volume/ceph_volume/util/disk.py +++ b/src/ceph-volume/ceph_volume/util/disk.py @@ -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, @@ -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