Comment 4 for bug 1513085

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

if I read the curtin method commands/block_meta.py:partition_handler correctly there is no way to directly specify sectors in the yaml.
With that in mind IMHO MAAS can't easily force the hard 4MB alignment so curtin has to deal with the fix.

After an experimental version 1 I found http://users.suse.com/~garloff/align_partition.py which is GPL and contains almost all we need.

The patch:
- aligns partition start and end at 4MB
- also considers disk alignment offset when aligning
- adds the feature of taking care of 512b/4k logical sector size when partitioning

The following patch is is a suggestion to start review and discussion before going further down that path.

The former test log now looks like:
Running command ['parted', '/dev/vdb', '--script', 'mkpart', 'primary', '8192s', '6299648s']
Running command ['parted', '/dev/vdb', '--script', 'mkpart', 'extended', '6307840s', '16793600s']
Running command ['parted', '/dev/vdb', '--script', 'mkpart', 'logical', '6316032s', '10510336s']
Running command ['parted', '/dev/vdb', '--script', 'mkpart', 'logical', '10518528s', '14712832s']