Skip to content
Open
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 butane/docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Butane 0.29.0 is the last release from this standalone repository. Butane has be

### Bug fixes


### Misc. changes

- Add support for pretty error reporting, can be controlled through
Expand Down
1 change: 1 addition & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ nav_order: 9

### Bug fixes

- fix butane root partition constraint check to only examine subsequent partitions

## Upcoming Ignition 2.27.0 (unreleased)

Expand Down
Loading