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

feat(storage): config support to reuse file systems #1575

Merged

Conversation

joseivanlopez
Copy link
Contributor

@joseivanlopez joseivanlopez commented Sep 4, 2024

Allow using reuseIfPossible for a filesystem section in the storage JSON config. The auto_storage document proposes to have a reuse property, but reuseIfPossible was used instead, see #1575 (review):

If reuseIfPossible is true, then Agama will try to reuse the file system, if any. In that case, some other properties from the filesystem section would be ignored.

Example:

{
  "search": "/dev/vda1",
  "filesystem": {
    "reuseIfPossible": true,
    "path": "/logs",
    "type": "xfs",
    "mkfsOptions": ["rw"]
  }
}

The properties type and mkfsOptions would be considered by Agama only if the file system is not finally reused.

@coveralls
Copy link

coveralls commented Sep 4, 2024

Coverage Status

coverage: 71.801% (-0.002%) from 71.803%
when pulling a5b7c46 on joseivanlopez:storage-reuse-filesystem
into f38e15b on openSUSE:master.

@@ -869,9 +869,9 @@
"type": "object",
"additionalProperties": false,
"properties": {
"reuse": {
"reuseIfPossible": {
Copy link
Contributor Author

@joseivanlopez joseivanlopez Sep 5, 2024

Choose a reason for hiding this comment

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

The document auto_storage proposes to have a reuse property, but reuseIfPossible was used because the following reasons:

a) A file system cannot be reused if the partition is going to be created (search is not specified).
b) A file system cannot be reused if the device is going to be encrypted.
c) A file system cannot be reused if the encryption layer is not going to be reused too.
d) A file system cannot be reused if the device is not currently formatted.

Validating the JSON config to avoid the usage of reuse in a, b and c would make the schema definition much more complex with very little benefit. Moreover, d cannot be validated at schema level because it requires information about the system.

The property was called reuseIfPossible to indicate that Agama will try reusing the existing file system if it is actually possible.

@joseivanlopez joseivanlopez marked this pull request as ready for review September 5, 2024 10:30
@@ -24,6 +24,51 @@
require "agama/storage/config"
require "y2storage/agama_proposal"

# @param config [Agama::Storage::Configs::Drive, Agama::Storage::Configs::Partition]
Copy link
Contributor

Choose a reason for hiding this comment

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

These methods look like a hint that we need (or will shortly need) shared helpers or factories for creating config objects and similar stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally agree.

ancorgs

This comment was marked as resolved.

Copy link
Contributor

@ancorgs ancorgs left a comment

Choose a reason for hiding this comment

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

LGTM

@joseivanlopez joseivanlopez merged commit d6a691a into agama-project:master Sep 6, 2024
4 checks passed
@imobachgs imobachgs mentioned this pull request Sep 20, 2024
imobachgs added a commit that referenced this pull request Sep 20, 2024
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