From: Alfredo Deza Date: Tue, 27 Nov 2018 14:26:33 +0000 (-0500) Subject: ceph-volume util.disk fix issue when capturing partition information X-Git-Tag: v14.1.0~747^2~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=28cb13a970909dc8efe508aee18f47e0fb3fdde3;p=ceph.git ceph-volume util.disk fix issue when capturing partition information Before, the `if` condition meant that it would only work when the output was '1', which is incorrect as that would only happen if a partition was the first one, ignoring any other partition. The contents of that file is the partition number, not a boolean to tell if it is a partition or not. It now includes the `holders` file contents which is needed for dm-mapper work Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/util/disk.py b/src/ceph-volume/ceph_volume/util/disk.py index 712b0dbda8fb..40b2408d3bfd 100644 --- a/src/ceph-volume/ceph_volume/util/disk.py +++ b/src/ceph-volume/ceph_volume/util/disk.py @@ -672,7 +672,7 @@ def get_partitions_facts(sys_block_path): folder_path = os.path.join(sys_block_path, folder) if os.path.exists(os.path.join(folder_path, 'partition')): contents = get_file_contents(os.path.join(folder_path, 'partition')) - if '1' in contents: + if contents: part = {} partname = folder part_sys_block_path = os.path.join(sys_block_path, partname) @@ -686,6 +686,9 @@ def get_partitions_facts(sys_block_path): part['sectorsize'] = get_file_contents( part_sys_block_path + "/queue/hw_sector_size", 512) part['size'] = human_readable_size(float(part['sectors']) * 512) + part['holders'] = [] + for holder in os.listdir(part_sys_block_path + '/holders'): + part['holders'].append(holder) partition_metadata[partname] = part return partition_metadata