]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
adds the util.disk.is_mapper_device method
authorAndrew Schoen <aschoen@redhat.com>
Thu, 28 Jun 2018 17:14:12 +0000 (12:14 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 1 Aug 2018 20:56:09 +0000 (15:56 -0500)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
(cherry picked from commit 852a466fdfa29c91f266ec122dcd5b01b8d1fca5)

src/ceph-volume/ceph_volume/util/disk.py

index 21b12d475b313c9c44b77c7343fd6bf3917bd89f..256947d363258351ee424d18614bdc9c9b335052 100644 (file)
@@ -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