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

storage: fix partial reformat not removing all candidate partitions #2094

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

ogayot
Copy link
Member

@ogayot ogayot commented Oct 1, 2024

When reformatting a disk that has in-use (i.e., mounted) partitions, we do a "partial" reformat, which means we attempt to delete all the partitions that are not in use.

Unfortunately, the implementation was not correct. While iterating over the partitions, calling delete_partition affects the iterator. As a consequence, some partitions that should have been removed end up preserved.

Fixed by iterating over a copy of the container.

LP:#2083322

When reformatting a disk that has in-use (i.e., mounted) partitions, we
do a "partial" reformat, which means we attempt to delete all the
partitions that are *not* in use.

Unfortunately, the implementation was not correct. While iterating over
the partitions, calling delete_partition affects the iterator. As a
consequence, some partitions that should have been removed end up
preserved.

Fixed by iterating over a copy of the container.

LP: #2083322

Signed-off-by: Olivier Gayot <[email protected]>
@ogayot ogayot merged commit 1c4c995 into canonical:main Oct 1, 2024
12 checks passed
@ogayot ogayot deleted the partial-reformat branch October 1, 2024 15:33
@mwhudson
Copy link
Collaborator

mwhudson commented Oct 1, 2024

argh! good spot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants