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 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 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 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 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 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 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 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 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 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 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 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 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
Loading