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 <adeza@redhat.com>
(cherry picked from commit
28cb13a970909dc8efe508aee18f47e0fb3fdde3)
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)
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