blueprint: update Disk customization with new features
- Partition table type: https://github.com/osbuild/images/pull/1085 - Partition type IDs: https://github.com/osbuild/images/pull/1115
This commit is contained in:
parent
6a112877f1
commit
330ce26715
3 changed files with 17 additions and 4 deletions
|
|
@ -349,12 +349,14 @@ func Convert(bp Blueprint) iblueprint.Blueprint {
|
|||
}
|
||||
if disk := c.Disk; disk != nil {
|
||||
idisk := &iblueprint.DiskCustomization{
|
||||
Type: disk.Type,
|
||||
MinSize: disk.MinSize,
|
||||
Partitions: make([]iblueprint.PartitionCustomization, len(disk.Partitions)),
|
||||
}
|
||||
for idx, part := range disk.Partitions {
|
||||
ipart := iblueprint.PartitionCustomization{
|
||||
Type: part.Type,
|
||||
PartType: part.PartType,
|
||||
MinSize: part.MinSize,
|
||||
BtrfsVolumeCustomization: iblueprint.BtrfsVolumeCustomization{},
|
||||
VGCustomization: iblueprint.VGCustomization{
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ func TestConvert(t *testing.T) {
|
|||
},
|
||||
Disk: &DiskCustomization{
|
||||
MinSize: 10240,
|
||||
Type: "gpt",
|
||||
Partitions: []PartitionCustomization{
|
||||
{
|
||||
// this partition is invalid, since only one of
|
||||
|
|
@ -121,8 +122,9 @@ func TestConvert(t *testing.T) {
|
|||
// the converter copies everything
|
||||
// unconditionally, so let's test the full
|
||||
// thing
|
||||
Type: "plain",
|
||||
MinSize: 1024,
|
||||
Type: "plain",
|
||||
MinSize: 1024,
|
||||
PartType: "0FC63DAF-8483-4772-8E79-3D69D8477DE4",
|
||||
BtrfsVolumeCustomization: BtrfsVolumeCustomization{
|
||||
Subvolumes: []BtrfsSubvolumeCustomization{
|
||||
{
|
||||
|
|
@ -413,6 +415,7 @@ func TestConvert(t *testing.T) {
|
|||
},
|
||||
Disk: &iblueprint.DiskCustomization{
|
||||
MinSize: 10240,
|
||||
Type: "gpt",
|
||||
Partitions: []iblueprint.PartitionCustomization{
|
||||
{
|
||||
// this partition is invalid, since only one of
|
||||
|
|
@ -420,8 +423,9 @@ func TestConvert(t *testing.T) {
|
|||
// the converter copies everything
|
||||
// unconditionally, so let's test the full
|
||||
// thing
|
||||
Type: "plain",
|
||||
MinSize: 1024,
|
||||
Type: "plain",
|
||||
MinSize: 1024,
|
||||
PartType: "0FC63DAF-8483-4772-8E79-3D69D8477DE4",
|
||||
BtrfsVolumeCustomization: iblueprint.BtrfsVolumeCustomization{
|
||||
Subvolumes: []iblueprint.BtrfsSubvolumeCustomization{
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
)
|
||||
|
||||
type DiskCustomization struct {
|
||||
Type string
|
||||
MinSize uint64
|
||||
Partitions []PartitionCustomization
|
||||
}
|
||||
|
|
@ -54,6 +55,12 @@ type PartitionCustomization struct {
|
|||
// (optional, defaults depend on payload and mountpoints).
|
||||
MinSize uint64 `json:"minsize" toml:"minsize"`
|
||||
|
||||
// The partition type GUID for GPT partitions. For DOS partitions, this
|
||||
// field can be used to set the (2 hex digit) partition type.
|
||||
// If not set, the type will be automatically set based on the mountpoint
|
||||
// or the payload type.
|
||||
PartType string `json:"part_type,omitempty" toml:"part_type,omitempty"`
|
||||
|
||||
BtrfsVolumeCustomization
|
||||
|
||||
VGCustomization
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue