Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions butane/config/fcos/v1_3/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ func (c Config) ToIgn3_2Unvalidated(options common.TranslateOptions) (types.Conf
if partition.Label != nil {
if *partition.Label == "root" {
if partition.SizeMiB == nil || *partition.SizeMiB == 0 {
for idx := range disk.Partitions {
if idx == p {
continue
}
for idx := p + 1; idx < len(disk.Partitions); idx++ {
if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 {
r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained)
break
Expand Down
31 changes: 31 additions & 0 deletions butane/config/fcos/v1_3/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,37 @@ func TestRootPartitionConstraints(t *testing.T) {
},
},
},
{
name: "root last with sized partitions before",
in: Config{
Config: base.Config{
Storage: base.Storage{
Disks: []base.Disk{
{
Device: "/dev/vda",
Partitions: []base.Partition{
{
Label: util.StrToPtr("bios"),
Number: 1,
SizeMiB: util.IntToPtr(1),
},
{
Label: util.StrToPtr("boot"),
Number: 3,
SizeMiB: util.IntToPtr(2048),
},
{
Label: util.StrToPtr("root"),
Number: 4,
},
},
},
},
},
},
},
report: report.Report{}, // no warning expected
},
}

for _, test := range tests {
Expand Down
5 changes: 1 addition & 4 deletions butane/config/fcos/v1_4/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ func (c Config) ToIgn3_3Unvalidated(options common.TranslateOptions) (types.Conf
if partition.Label != nil {
if *partition.Label == "root" {
if partition.SizeMiB == nil || *partition.SizeMiB == 0 {
for idx := range disk.Partitions {
if idx == p {
continue
}
for idx := p + 1; idx < len(disk.Partitions); idx++ {
if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 {
r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained)
break
Expand Down
31 changes: 31 additions & 0 deletions butane/config/fcos/v1_4/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,37 @@ func TestRootPartitionConstraints(t *testing.T) {
},
},
},
{
name: "root last with sized partitions before",
in: Config{
Config: base.Config{
Storage: base.Storage{
Disks: []base.Disk{
{
Device: "/dev/vda",
Partitions: []base.Partition{
{
Label: util.StrToPtr("bios"),
Number: 1,
SizeMiB: util.IntToPtr(1),
},
{
Label: util.StrToPtr("boot"),
Number: 3,
SizeMiB: util.IntToPtr(2048),
},
{
Label: util.StrToPtr("root"),
Number: 4,
},
},
},
},
},
},
},
report: report.Report{}, // no warning expected
},
}

for _, test := range tests {
Expand Down
5 changes: 1 addition & 4 deletions butane/config/fcos/v1_5/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ func (c Config) ToIgn3_4Unvalidated(options common.TranslateOptions) (types.Conf
if partition.Label != nil {
if *partition.Label == "root" {
if partition.SizeMiB == nil || *partition.SizeMiB == 0 {
for idx := range disk.Partitions {
if idx == p {
continue
}
for idx := p + 1; idx < len(disk.Partitions); idx++ {
if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 {
r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained)
break
Expand Down
31 changes: 31 additions & 0 deletions butane/config/fcos/v1_5/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,37 @@ func TestRootPartitionConstraints(t *testing.T) {
},
},
},
{
name: "root last with sized partitions before",
in: Config{
Config: base.Config{
Storage: base.Storage{
Disks: []base.Disk{
{
Device: "/dev/vda",
Partitions: []base.Partition{
{
Label: util.StrToPtr("bios"),
Number: 1,
SizeMiB: util.IntToPtr(1),
},
{
Label: util.StrToPtr("boot"),
Number: 3,
SizeMiB: util.IntToPtr(2048),
},
{
Label: util.StrToPtr("root"),
Number: 4,
},
},
},
},
},
},
},
report: report.Report{}, // no warning expected
},
}

for _, test := range tests {
Expand Down
5 changes: 1 addition & 4 deletions butane/config/fcos/v1_6/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ func (c Config) ToIgn3_5Unvalidated(options common.TranslateOptions) (types.Conf
if partition.Label != nil {
if *partition.Label == "root" {
if partition.SizeMiB == nil || *partition.SizeMiB == 0 {
for idx := range disk.Partitions {
if idx == p {
continue
}
for idx := p + 1; idx < len(disk.Partitions); idx++ {
if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 {
r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained)
break
Expand Down
31 changes: 31 additions & 0 deletions butane/config/fcos/v1_6/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,37 @@ func TestRootPartitionConstraints(t *testing.T) {
},
},
},
{
name: "root last with sized partitions before",
in: Config{
Config: base.Config{
Storage: base.Storage{
Disks: []base.Disk{
{
Device: "/dev/vda",
Partitions: []base.Partition{
{
Label: util.StrToPtr("bios"),
Number: 1,
SizeMiB: util.IntToPtr(1),
},
{
Label: util.StrToPtr("boot"),
Number: 3,
SizeMiB: util.IntToPtr(2048),
},
{
Label: util.StrToPtr("root"),
Number: 4,
},
},
},
},
},
},
},
report: report.Report{}, // no warning expected
},
}

for _, test := range tests {
Expand Down
5 changes: 1 addition & 4 deletions butane/config/fcos/v1_7/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ func (c Config) ToIgn3_6Unvalidated(options common.TranslateOptions) (types.Conf
if partition.Label != nil {
if *partition.Label == "root" {
if partition.SizeMiB == nil || *partition.SizeMiB == 0 {
for idx := range disk.Partitions {
if idx == p {
continue
}
for idx := p + 1; idx < len(disk.Partitions); idx++ {
if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 {
r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained)
break
Expand Down
31 changes: 31 additions & 0 deletions butane/config/fcos/v1_7/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,37 @@ func TestRootPartitionConstraints(t *testing.T) {
},
},
},
{
name: "root last with sized partitions before",
in: Config{
Config: base.Config{
Storage: base.Storage{
Disks: []base.Disk{
{
Device: "/dev/vda",
Partitions: []base.Partition{
{
Label: util.StrToPtr("bios"),
Number: 1,
SizeMiB: util.IntToPtr(1),
},
{
Label: util.StrToPtr("boot"),
Number: 3,
SizeMiB: util.IntToPtr(2048),
},
{
Label: util.StrToPtr("root"),
Number: 4,
},
},
},
},
},
},
},
report: report.Report{}, // no warning expected
},
}

for _, test := range tests {
Expand Down
5 changes: 1 addition & 4 deletions butane/config/fcos/v1_8_exp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ func (c Config) ToIgn3_7Unvalidated(options common.TranslateOptions) (types.Conf
if partition.Label != nil {
if *partition.Label == "root" {
if partition.SizeMiB == nil || *partition.SizeMiB == 0 {
for idx := range disk.Partitions {
if idx == p {
continue
}
for idx := p + 1; idx < len(disk.Partitions); idx++ {
if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 {
r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained)
break
Expand Down
31 changes: 31 additions & 0 deletions butane/config/fcos/v1_8_exp/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,37 @@ func TestRootPartitionConstraints(t *testing.T) {
},
},
},
{
name: "root last with sized partitions before",
in: Config{
Config: base.Config{
Storage: base.Storage{
Disks: []base.Disk{
{
Device: "/dev/vda",
Partitions: []base.Partition{
{
Label: util.StrToPtr("bios"),
Number: 1,
SizeMiB: util.IntToPtr(1),
},
{
Label: util.StrToPtr("boot"),
Number: 3,
SizeMiB: util.IntToPtr(2048),
},
{
Label: util.StrToPtr("root"),
Number: 4,
},
},
},
},
},
},
},
report: report.Report{}, // no warning expected
},
}

for _, test := range tests {
Expand Down
1 change: 1 addition & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ nav_order: 9
- Resolve intermediate symlinks in relabel paths, fixing SELinux relabeling failures for users with `home_dir` on OSTree platforms after policycoreutils 3.11 ([#2316](https://github.com/coreos/ignition/pull/2316))
- Fix Butane rendering large `sizeMiB`/`startMiB` values in scientific
notation when generating OpenShift MachineConfig YAML ([#2310](https://github.com/coreos/ignition/pull/2310))
- Fix the Butane root partition constraint check to only examine subsequent partitions ([#2304](https://github.com/coreos/ignition/pull/2304))

## Ignition 2.27.0 (2026-08-26)

Expand Down
Loading