Skip to content

Conversation

@ogayot
Copy link
Member

@ogayot ogayot commented Jan 27, 2025

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
if data.partition.format != partition.original_fstype():
if data.partition.wipe is None:
raise ValueError("changing partition format requires a wipe value")
if data.partition.wipe is None and partition.preserve:
Copy link
Member Author

@ogayot ogayot Jan 27, 2025

Choose a reason for hiding this comment

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

Should we check the value of preserve at the FS level (which may or may not exist) ? This is what we do to label "to be reformatted as ...." and "to be formatted as ....".

fs = device.fs()
if fs is not None:
if fs.preserve:
format_desc = _("already formatted as {fstype}")
elif device.original_fstype() is not None:
format_desc = _("to be reformatted as {fstype}")
else:
format_desc = _("to be formatted as {fstype}")

Copy link
Member Author

Choose a reason for hiding this comment

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

@dbungert do you know? i.e., the difference between partition.preserve and partition.fs.preserve?

Copy link
Member

Choose a reason for hiding this comment

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

I will defer to the curtin documentation on this one. https://curtin.readthedocs.io/en/latest/topics/storage.html

From a label standpoint this is a very subtle difference.

When dealing with a new partition, changing the format from e.g. ext4 to
unformatted should not require a wipe value. There is nothing yet to wipe.
OTOH it is still necessary for existing partitions.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
@ogayot ogayot force-pushed the wipe-change-format branch from 646207f to 60693ec Compare January 27, 2025 15:53
@ogayot ogayot changed the title When changing format of a new parittion, don't require wipe When changing format of a new partition, don't require wipe Jan 27, 2025
if data.partition.format != partition.original_fstype():
if data.partition.wipe is None:
raise ValueError("changing partition format requires a wipe value")
if data.partition.wipe is None and partition.preserve:
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to be clear, this works because preserve is already set for existing objects by default?

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