Fixed 4K alignment check under Linux
This commit is contained in:
parent
2a019d09a0
commit
5d6b7578d3
1 changed files with 2 additions and 2 deletions
|
|
@ -265,7 +265,7 @@ class Disk():
|
||||||
def is_4k_aligned(self):
|
def is_4k_aligned(self):
|
||||||
"""Check that all disk partitions are aligned, returns bool."""
|
"""Check that all disk partitions are aligned, returns bool."""
|
||||||
aligned = True
|
aligned = True
|
||||||
if not platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
aligned = is_4k_aligned_linux(self.path, self.details['phy-sec'])
|
aligned = is_4k_aligned_linux(self.path, self.details['phy-sec'])
|
||||||
#TODO: Add checks for other OS
|
#TODO: Add checks for other OS
|
||||||
|
|
||||||
|
|
@ -471,7 +471,7 @@ def is_4k_aligned_linux(dev_path, physical_sector_size):
|
||||||
# Check partitions
|
# Check partitions
|
||||||
for part in json_data.get('partitiontable', {}).get('partitions', []):
|
for part in json_data.get('partitiontable', {}).get('partitions', []):
|
||||||
offset = physical_sector_size * part.get('start', -1)
|
offset = physical_sector_size * part.get('start', -1)
|
||||||
aligned = aligned and offset >= 0 and offset % 2096 == 0
|
aligned = aligned and offset >= 0 and offset % 4096 == 0
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
return aligned
|
return aligned
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue