@@ -68,17 +68,34 @@ func (c Config) ToIgn3_4Unvalidated(options common.TranslateOptions) (types.Conf
6868 return types.Config {}, translate.TranslationSet {}, r
6969 }
7070 r .Merge (c .processBootDevice (& ret , & ts , options ))
71+
7172 for i , disk := range ret .Storage .Disks {
72- // In the boot_device.mirror case, nothing specifies partition numbers
73- // so match existing partitions only when `wipeTable` is false
74- if ! util .IsTrue (disk .WipeTable ) {
75- for j , partition := range disk .Partitions {
76- // check for reserved partlabels
77- if partition .Label != nil {
73+ for p , partition := range disk .Partitions {
74+ //if the partition is not nil and is root
75+ if partition .Label != nil {
76+ if * partition .Label == "root" {
77+ if partition .SizeMiB == nil || * partition .SizeMiB == 0 {
78+ for _ , ap := range disk .Partitions {
79+ if ap .Number == partition .Number + 1 {
80+ if ap .StartMiB == nil || * ap .StartMiB == 0 {
81+ r .AddOnWarn (path .New ("json" , "storage" , "disks" , i , "partitions" , p , "number" ), common .ErrRootConstrained )
82+ }
83+ }
84+ }
85+ } else if * partition .SizeMiB < 8192 {
86+ r .AddOnWarn (path .New ("json" , "storage" , "disks" , i , "partitions" , p , "size_mib" ), common .ErrRootTooSmall )
87+ }
88+ }
89+
90+ // In the boot_device.mirror case, nothing specifies partition numbers
91+ // so match existing partitions only when `wipeTable` is false
92+ if ! util .IsTrue (disk .WipeTable ) {
93+ // check for reseved partlabels
7894 if (* partition .Label == "BIOS-BOOT" && partition .Number != 1 ) || (* partition .Label == "PowerPC-PReP-boot" && partition .Number != 1 ) || (* partition .Label == "EFI-SYSTEM" && partition .Number != 2 ) || (* partition .Label == "boot" && partition .Number != 3 ) || (* partition .Label == "root" && partition .Number != 4 ) {
79- r .AddOnWarn (path .New ("json" , "storage" , "disks" , i , "partitions" , j , "label" ), common .ErrWrongPartitionNumber )
95+ r .AddOnWarn (path .New ("json" , "storage" , "disks" , i , "partitions" , p , "label" ), common .ErrWrongPartitionNumber )
8096 }
8197 }
98+
8299 }
83100 }
84101 }
0 commit comments