Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple fixes for size: -1 partitions #1445

Merged
merged 7 commits into from
Nov 2, 2022

Conversation

ogayot
Copy link
Member

@ogayot ogayot commented Oct 6, 2022

  • fixed implementation of disk.available_for_partitions that always considered the disk had a GPT.
  • fixed bug forcing the user to hard-code all offsets when using storage version 2 with a partition with size: -1. https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/1991413
  • fixed sometimes wrong size assigned to a partition that had size: -1. The value -1 (that is an valid integer) was used accidentally in the computations to determine the appropriate size for the partition. https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/1991929
  • fixed my recent unit tests that were not specifying the partition table type. This resulted in a GPT partition table (that use different alignment and space constraints).

I am now able run a successful autoinstall with the data from https://bugs.launchpad.net/subiquity/+bug/1989977 without hard-coding any offset. The 1MiB that was missing on the final logical partition in the earlier implementation is now claimed properly.
I added this test case as a unit test: test_partition_remaining_size_in_extended_and_logical_multiple

In the new tests recently added to test_filesystem.py, the initial disk
object was marked having a msdos partition table.

This is fine for computing offsets manually. However, what really needs
to be done is to mark the partition table as msdos in the YAML itself.
Otherwise, the disk is reformatted as GPT.

This makes gap functions use the right alignment data when computing the
list of gaps available.

Sadly it breaks the tests because of other issues, so I added FIXME tags
in the broken tests.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The available_for_partitions function wrongly assumed that the
underlying disk had a GPT partition table. Updated the implementation to
use the alignment data as expected.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
@ogayot ogayot requested a review from dbungert October 6, 2022 14:06
When storage version 2 is used, partitions require an offset. When
loading partitions via an autoinstall file, we now make sure to assign
offsets automatically if the user did not specify offsets.

https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/1991413

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When size: -1 is specified on a given partition, we attempt to determine
the its right size by looping through the partitions and computing a
list of available gaps.

That said, when looping through the partitions, we also include the one
which has an incomplete (i.e. = -1) size. This makes the computation
rely on a negative value and this often leads to incorrect result.

Fixed by excluding the current partition when determining its
appropriate size.

https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/1991929

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Copy link
Collaborator

@dbungert dbungert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in review.
Great test additions!
One change I would like to see then it's ready, thanks.

subiquity/models/filesystem.py Outdated Show resolved Hide resolved
…fsets

Storage version 2 is a global setting. Having one disk use storage
version 1 and another with storage version 2 should not be possible and
should not be considered a valid use-case.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
@ogayot ogayot merged commit d41c3b9 into canonical:main Nov 2, 2022
@ogayot ogayot deleted the LP1991413-LP1991929 branch November 2, 2022 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants