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

Add support for advanced partitioning customizations (COMPOSER-2399) #4535

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

achilleas-k
Copy link
Member

This PR enables the disk customizations in osbuild-composer.

Tests for the new blueprint configurations have been added to filesystem.sh.


This pull request includes:

  • adequate testing for the new functionality or fixed issue
  • adequate documentation informing people about the change such as
    • submit a PR for the READMEs listed here
    • submit a PR for the osbuild.org website repository if this PR changed any behavior not covered by the automatically updated READMEs

Add DiskCustomization and all its children to the internal blueprint.
Add the conversion to the images counterpart to the Convert() function.
Move the creation of the blueprint to a function.  We'll then add a
separate blueprint function for the new, alternative partitioning
customization.
Version 94 of osbuild-composer is over a year old now.  It should be
fine to test these unconditionally.
@achilleas-k achilleas-k changed the title Add support for advanced partitioning customizations Add support for advanced partitioning customizations (COMPOSER-2399) Dec 18, 2024
@achilleas-k achilleas-k force-pushed the all-the-partitioning-all-the-time branch from 75cb610 to df59325 Compare December 18, 2024 14:37
Add separate blueprint creation functions, one for each partitioning
layout:
- disk-plain
- disk-lvm
- disk-btrfs (Fedora only)

The existing 'filesystem' blueprint is also kept.

Each function also sets the $EXPECTED_MOUNTPOINTS variable for the
mountpoint check that happens after the build.
Remove incorrect comment (not an ostree image).
Add a greenprint for depsolving since it can take some time for that to
run and it makes more sense than pausing output on "Preparing
blueprint".
Run filesystem.sh with all the valid arguments for the customization
type.
@achilleas-k achilleas-k force-pushed the all-the-partitioning-all-the-time branch from df59325 to 423fb63 Compare December 18, 2024 18:08
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, I have a very silly question inline, it comes down to if we can find a way to avoid some of the duplication with the images code that are currently present in this PR.

@@ -19,6 +19,7 @@ type Customizations struct {
Firewall *FirewallCustomization `json:"firewall,omitempty" toml:"firewall,omitempty"`
Services *ServicesCustomization `json:"services,omitempty" toml:"services,omitempty"`
Filesystem []FilesystemCustomization `json:"filesystem,omitempty" toml:"filesystem,omitempty"`
Disk *DiskCustomization `json:"disk,omitempty" toml:"disk,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a very stupid (sorry!) question - could we simply do:

iff --git a/internal/blueprint/customizations.go b/internal/blueprint/customiza
tions.go
index 9ec43401f..5efe3eb40 100644
--- a/internal/blueprint/customizations.go
+++ b/internal/blueprint/customizations.go
@@ -5,33 +5,34 @@ import (
        "reflect"
        "strings"
 
+       "github.com/osbuild/images/pkg/blueprint"
        "github.com/osbuild/images/pkg/disk"
 )
...
-       Disk               *DiskCustomization        `json:"disk,omitempty" toml:"disk,omitempty"`
+       Disk *blueprint.DiskCustomization `json:"disk,omitempty" toml:"disk,omitempty"`
...

here (and remove disk_customizations.go in this PR)?

And then we would add a "Validate()" that simply disallows the "dc.Type" (as it seems that is the only thing we do not support compared to the images disk_blueprint)?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think with the work we're doing to unify blueprints, it might be a good idea to just drop the whole copy from here and make it use the one from images directly.

"github.com/osbuild/images/pkg/datasizes"
)

type DiskCustomization struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

See my question above, I really would like to avoid this duplication, I'm worried it will lead to drift and I am also not sure why we need it (but maybe/surely I'm missing something here?)

@achilleas-k
Copy link
Member Author

I need to update image-info to handle btrfs subvolumes and ignore swap partitions when mounting filesystems.

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.

2 participants