disk: Add support for raw partitions, custom types and UKIBoot partition layout#1685
Conversation
thozza
left a comment
There was a problem hiding this comment.
Thank you for your contribution.
Unfortunately, I'm not a fan of this approach and the changes done to addPlainPartition(). My suggestion would be to allow users to define this scenario by explicit options in the FS customizations, instead of having a special case logic if specific options are not set at all (since it could be just a user error, which would now get caught by this special case).
I would also like you to extend unit tests to cover cases such as no partition label being set, etc...
mvo5
left a comment
There was a problem hiding this comment.
Thanks, this looks nice, two tiny (optional) suggestions and a question inline. We also want @achilleas-k review here as he is the expert in this area :)
36d7cc7 to
d8159dd
Compare
|
@thozza @mvo5 I've updated my branch with changes to address your feedback and suggestions. The changes for v2 are the following:
|
d8159dd to
3c5475a
Compare
achilleas-k
left a comment
There was a problem hiding this comment.
Thanks. LGTM. One very small comment, but not a blocker. Feel free to ignore.
| case fstype == "none": | ||
| if partition.Label != "" { | ||
| typeName = partition.Label | ||
| } else { | ||
| typeName = "data" | ||
| } |
There was a problem hiding this comment.
Tiniest of nitpicks:
I'd prefer if the ukiboot_a and ukiboot_b labels mapping to the ukiboot type happened here instead of in the getPartitionTypeIDfor() function. It's not very important, but I think of the types that get passed to getPartitionTypeIDfor() to be common names for the types of partitions we handle. In fact, I was considering changing that to an enum with type names matching the names as they appear in fdisk. So with that logic, the getPartitionTypeIDfor() function would only know those types and it's up to the caller to make the decision based on mountpoint or label.
So this would then be:
case fstype == "none":
switch partition.Label {
case "ukiboot_a", "ukiboot_b":
typeName = "ukiboot"
case "ukibootctl":
typeName = "ukibootctl"
default:
typeName = "data"
}There was a problem hiding this comment.
@achilleas-k I've pushed a v3 addressing this comment. The full diff between v2 and v3 is the following:
diff --git a/pkg/disk/disk.go b/pkg/disk/disk.go
index 4c4b206ba99b..7e8d2d498af2 100644
--- a/pkg/disk/disk.go
+++ b/pkg/disk/disk.go
@@ -175,7 +175,7 @@ func getPartitionTypeIDfor(ptType PartitionTableType, partTypeName string, archi
default:
return "", fmt.Errorf("unknown or unsupported architecture enum value: %d", architecture)
}
- case "ukiboot_a", "ukiboot_b":
+ case "ukiboot":
return UKIBootPartitionUUID, nil
case "ukibootctl":
return UKIBootCtlPartitionUUID, nil
diff --git a/pkg/disk/partition_table.go b/pkg/disk/partition_table.go
index dce7382434bf..92be355c21bd 100644
--- a/pkg/disk/partition_table.go
+++ b/pkg/disk/partition_table.go
@@ -1428,9 +1428,12 @@ func addPlainPartition(pt *PartitionTable, partition blueprint.PartitionCustomiz
case partition.Mountpoint == "/boot":
typeName = "boot"
case fstype == "none":
- if partition.Label != "" {
- typeName = partition.Label
- } else {
+ switch partition.Label {
+ case "ukiboot_a", "ukiboot_b":
+ typeName = "ukiboot"
+ case "ukibootctl":
+ typeName = "ukibootctl"
+ default:
typeName = "data"
}
case fstype == "swap":
There was a problem hiding this comment.
Thanks. Your diff here looks good, but I don't see the change in the PR diff.
There was a problem hiding this comment.
@achilleas-k yeah, because since that change @mvo5 and @thozza had more comments and at the end the mapping was gone :)
3c5475a to
ee0ebe9
Compare
mvo5
left a comment
There was a problem hiding this comment.
Thanks, lots to like here - but I do wonder if we really need to add knowledge about the uki boot here or if adding "fstype" none is enough. I mean, it might be fine, how widely used is it?
thozza
left a comment
There was a problem hiding this comment.
Thank you for all the changes, this looks much better now and almost perfect (please see my inline comment).
fdbaad4 to
ac36012
Compare
mvo5
left a comment
There was a problem hiding this comment.
Thanks! Two tiny question/suggestion inline, if you are busy we can take care of it. This may need a decision by e.g. @achilleas-k if we allow payload to be nil or add a new disk.Raw{} structure
5e519db to
37849bf
Compare
mvo5
left a comment
There was a problem hiding this comment.
I love how simple this has become, one tiny suggestion about a comment but approving already as I think that its optional (but would be nice I think)
331bc3a to
f020eb3
Compare
f020eb3 to
ab2add2
Compare
ab2add2 to
031dae2
Compare
thozza
left a comment
There was a problem hiding this comment.
Nice, LGTM. I appreciate your patience.
|
Seems like these failures are some random registry issues. Can we re-run them? |
Sadly no, Fedora's infra is having a bunch of issues at the moment. I'm asking around if we can make (some of) these checks non-required while this is going on. |
Add the capability to create raw (unformatted) partitions, for custom boot setups that require partitions with specific GPT types but no filesystems. The plain partition with fs_type none doesn't have to specify a mountpoint in its customization, similarly to plain swap partitions that also don't have formatted filesystems. For these raw partitions, the GPT partition type GUID can be specified. If is not specified, the type defaults to the "data" partition type. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Add a test for the creation of UKIBoot and UKIBoot control partitions as required by the UKIBoot protocol. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
031dae2 to
856487f
Compare
achilleas-k
left a comment
There was a problem hiding this comment.
Love how this turned out. Thanks for being so patient with our endless reviews.
LGTM!
@achilleas-k @thozza @mvo5 on the contrary, thanks a lot folks for all your feedback and comments! |
This commit syncs the latest changes from the blueprint changes in the images library. See osbuild/image-builder#1685
This commit syncs the latest changes from the blueprint changes in the images library. See osbuild/image-builder#1685
This commit syncs the latest changes from the blueprint changes in the images library. See osbuild/image-builder#1685
This pull-request adds the capability to create raw (unformatted) partitions, for custom boot setups that require partitions with specific GPT types but without a filesystem (e.g: ukiboot).
It also adds the specific GPT type UUIDs for UKIBoot (UKIBootPartitionUUID) and the UKIBoot control (UKIBootCtlPartitionUUID) partition types. And the logic to properly map these types with the UKIBoot partitions, based on their labels.
Having this support will allow bootc-image-builder to embedded customization files to generate images that can be booted using UKIBoot.