From 852a466fdfa29c91f266ec122dcd5b01b8d1fca5 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 28 Jun 2018 12:14:12 -0500 Subject: [PATCH] adds the util.disk.is_mapper_device method Signed-off-by: Andrew Schoen --- src/ceph-volume/ceph_volume/util/disk.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- 2.39.5