Closed vojtechtrefny closed 7 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 13.35%. Comparing base (
da929b9
) to head (0dc6ee8
). Report is 1 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
So is there a bug in https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/hardware/linux.py#L674 ? specifically https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/hardware/linux.py#L770
part['sectorsize'] = get_file_content(part_sysdir + "/queue/logical_block_size")
if not part['sectorsize']:
part['sectorsize'] = get_file_content(part_sysdir + "/queue/hw_sector_size", 512)
? If so, what should be done to fix that?
[citest]
The anbile calculations are correct -- all sizes in sysfs are in 512 sectors (large sizes, small sizes like the sector size itself are in bytes) so ansible is just displaying the size the same way kernel/sysfs would. When displaying the "human readable" size the number of sectors is correctly multiplied by 512. For our use case we can simply ignore sector size here, we don't need it.
Device sizes specified in sectors are in general in 512 sectors regardless of the actual device physical sector size. Example of ansible_devices facts for a 4k sector size drive:
... "sectors": "41943040", "sectorsize": "4096", "size": "20.00 GB" ...
Resolves: RHEL-30959