From 5f30a1edff98f788d99018c3020e9e25fc7e8e4f Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Tue, 27 Nov 2018 09:26:33 -0500 Subject: [PATCH] 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 (cherry picked from commit 28cb13a970909dc8efe508aee18f47e0fb3fdde3) --- src/ceph-volume/ceph_volume/util/disk.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ceph-volume/ceph_volume/util/disk.py b/src/ceph-volume/ceph_volume/util/disk.py index ccc2ff7a15226..171212d5601c6 100644 --- a/src/ceph-volume/ceph_volume/util/disk.py +++ b/src/ceph-volume/ceph_volume/util/disk.py @@ -631,7 +631,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) @@ -645,6 +645,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 -- 2.39.5