-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
filesystem: store the actual size in bytes alongside the human readab…
…le size Currently, the partition form stores the size as a human readable value. (e.g., 123456K, 1.1G, 1.876G, 100G). When we exit the size field (i.e., upon losing focus), we convert the value to a number of bytes and then align it up to the nearest MiB (or whatever the alignment requirement is). Unfortunately, after computing the aligned value, we turn it back into a human-readable string and store it as is. It is not okay because the conversion does not ensure that the alignment requirement is still honored. For instance, if the user types in 1.1G, we do the following: * convert it to a number of bytes -> 1181116006.4 (surprise, it is not even an integer). * round it up to the nearest MiB -> 1181745152 (this is the correct value) * transform it into a human readable string and store it as is -> 1.1G - which actually corresponds to the original value. This leads to an exception later when creating the partition: File "subiquity/models/filesystem.py", line 1841, in add_partition raise Exception( Exception: ('size %s or offset %s not aligned to %s', 1181116006, 1048576, 1048576) Fixed by storing the actual size as a number of bytes - alongside the human readable size. Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
- Loading branch information
Showing
3 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters