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(schema): guided and AutoYaST storage proposals #1263

Merged
merged 10 commits into from
Jul 4, 2024

Conversation

joseivanlopez
Copy link
Contributor

@joseivanlopez joseivanlopez commented May 27, 2024

Schema definition for the guided and AutoYaST storage proposals:

{
  "storage": {
    "guided": { }
  },
  "legacyAutoyastStorage": [ ]
}

Based on auto_storage.md which is expected to change over time.

Bonus: This includes a commit revisiting how title and description are used, to be more compliant with https://json-schema.org/understanding-json-schema/reference/annotations

Note for reviewers: you can easily check your JSON config files by using agama profile validate config.json

@coveralls
Copy link

coveralls commented May 27, 2024

Coverage Status

coverage: 71.408%. remained the same
when pulling 25585ac on joseivanlopez:storage-schema
into 32143a7 on openSUSE:master.

@ancorgs ancorgs force-pushed the storage-schema branch 3 times, most recently from ab1424b to 581878d Compare June 6, 2024 14:03
@ancorgs ancorgs marked this pull request as ready for review June 6, 2024 14:06
@ancorgs ancorgs force-pushed the storage-schema branch 3 times, most recently from a3ebd77 to 8eeabda Compare June 7, 2024 07:49
@imobachgs imobachgs added this to the Agama 9 milestone Jun 25, 2024
joseivanlopez added a commit that referenced this pull request Jun 26, 2024
Add CLI support for setting and getting the storage config.

### Load (set) storage settings from a config file:

~~~
$ agama config load < config.json
~~~

* The given settings must match the JSON schema defined by
#1263 (not finished yet).
* The storage service calculates either a guided proposal or an AutoYaST
proposal, depending on the given config.

Config for a guided proposal:

~~~json
{
  "storage": {
    "guided": {
      "target": {
        "disk": "/dev/vdc"
      }
    }
  }
}
~~~

Config for an AutoYaST proposal:

~~~json
{
  "legacyAutoyastStorage": [
    {
      "device": "/dev/vdc",
      "use": "all"
    }
  ]
}
~~~

### Recover (get) the storage config:

~~~
$ agama config show > config.json
$ agama config edit
~~~

NOTES

* The storage service should check whether the given settings fulfill
the JSON schema.
* Checking the schema is not done yet because the schema definition is
not finished.
@imobachgs imobachgs modified the milestones: Agama 9, Agama 10 Jun 26, 2024
@joseivanlopez joseivanlopez changed the title Auto-installation storage schema feat(schema): guided and AutoYaST storage proposals Jul 1, 2024
@mvidner

This comment was marked as resolved.

@mvidner

This comment was marked as resolved.

@mvidner

This comment was marked as resolved.

mvidner

This comment was marked as resolved.

@joseivanlopez

This comment was marked as resolved.

@joseivanlopez
Copy link
Contributor Author

joseivanlopez commented Jul 4, 2024

And maybe add validating the examples to our CI tests too?

Good idea. If you don't mind, I will create a separate card for that. IMHO, adding CI check is out-of-scope of this PR.

Copy link
Contributor

@mvidner mvidner left a comment

Choose a reason for hiding this comment

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

Thanks!

Co-authored-by: Martin Vidner <[email protected]>
@joseivanlopez joseivanlopez merged commit 7101d0d into agama-project:master Jul 4, 2024
1 check passed
mvidner added a commit that referenced this pull request Jul 19, 2024
## Problem

While reviewing #1263 I read the whole schema and saw room for
improvement. Small things

## Solution

- disallow additional properties
- more specific type than string
- put examples to their dedicated property

## Testing

Minimal, just making sure the schema itself is valid, by

```console
$ agama profile validate rust/agama-lib/share/examples/profile_gnome.json
The profile is valid
```
joseivanlopez added a commit that referenced this pull request Aug 27, 2024
Extend JSON schema to partially support the new *storage config*
described in this document:
https://github.com/openSUSE/agama/blob/master/doc/auto_storage.md.

This PR only extends the schema for the most basic settings (i.e.,
*boot*, *drives* and *partitions*). Settings for advanced searches,
delete devices, creeate RAIDs, etc are not considered yet.

Notes:

* The *search* section added in this PR is based on the following
proposal:
https://gist.github.com/joseivanlopez/4f2381eb1f6c3aca562aadc2ad920a72?permalink_comment_id=5121860#gistcomment-5121860.
This will be revisited later.
* The *guided* schema added by
#1263 is not going to be offered
(e.g., *$ agama config load* will not understand it). The *storage
config* will cover all the use cases and features provided by the
*guided config*.
* The *guided config* will be used only by clients (e.g., web UI) to
easily configure a subset of the use cases supported by the *storage
config*.
@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.

5 participants