@@ -146,6 +146,198 @@ func TestTranslateBootDevice(t *testing.T) {
146
146
},
147
147
},
148
148
},
149
+ // root partition too small
150
+ {
151
+ Config {
152
+ Config : base.Config {
153
+ Storage : base.Storage {
154
+ Disks : []base.Disk {
155
+ {
156
+ Device : "/dev/vda" ,
157
+ Partitions : []base.Partition {
158
+ {
159
+ Label : util .StrToPtr ("root" ),
160
+ SizeMiB : util .IntToPtr (500 ),
161
+ Resize : util .BoolToPtr (true ),
162
+ Number : 4 ,
163
+ },
164
+ {
165
+ Label : util .StrToPtr ("var-home" ),
166
+ SizeMiB : util .IntToPtr (10240 ),
167
+ },
168
+ },
169
+ },
170
+ },
171
+ Filesystems : []base.Filesystem {
172
+ {
173
+ Device : "/dev/disk/by-partlabel/var-home" ,
174
+ Format : util .StrToPtr ("xfs" ),
175
+ Path : util .StrToPtr ("/var/home" ),
176
+ Label : util .StrToPtr ("var-home" ),
177
+ WipeFilesystem : util .BoolToPtr (false ),
178
+ },
179
+ },
180
+ },
181
+ },
182
+ },
183
+ types.Config {
184
+ Ignition : types.Ignition {
185
+ Version : "3.4.0-experimental" ,
186
+ },
187
+ Storage : types.Storage {
188
+ Disks : []types.Disk {
189
+ {
190
+ Device : "/dev/vda" ,
191
+ Partitions : []types.Partition {
192
+ {
193
+ Label : util .StrToPtr ("root" ),
194
+ SizeMiB : util .IntToPtr (500 ),
195
+ Resize : util .BoolToPtr (true ),
196
+ Number : 4 ,
197
+ },
198
+ {
199
+ Label : util .StrToPtr ("var-home" ),
200
+ SizeMiB : util .IntToPtr (10240 ),
201
+ },
202
+ },
203
+ },
204
+ },
205
+ Filesystems : []types.Filesystem {
206
+ {
207
+ Device : "/dev/disk/by-partlabel/var-home" ,
208
+ Format : util .StrToPtr ("xfs" ),
209
+ Path : util .StrToPtr ("/var/home" ),
210
+ Label : util .StrToPtr ("var-home" ),
211
+ WipeFilesystem : util .BoolToPtr (false ),
212
+ },
213
+ },
214
+ },
215
+ },
216
+ []translate.Translation {
217
+ {path .New ("yaml" , "version" ), path .New ("json" , "ignition" , "version" )},
218
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 0 , "label" ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 0 , "label" )},
219
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 0 , "size_mib" ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 0 , "sizeMiB" )},
220
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 0 , "resize" ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 0 , "resize" )},
221
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 1 , "label" ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 1 , "label" )},
222
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 1 , "size_mib" ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 1 , "sizeMiB" )},
223
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 0 ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 0 )},
224
+ {path .New ("yaml" , "storage" , "disks" , 0 ), path .New ("json" , "storage" , "disks" , 0 )},
225
+ {path .New ("yaml" , "storage" , "filesystems" , 0 , "device" ), path .New ("json" , "storage" , "filesystems" , 0 , "device" )},
226
+ {path .New ("yaml" , "storage" , "filesystems" , 0 , "format" ), path .New ("json" , "storage" , "filesystems" , 0 , "format" )},
227
+ {path .New ("yaml" , "storage" , "filesystems" , 0 , "path" ), path .New ("json" , "storage" , "filesystems" , 0 , "path" )},
228
+ {path .New ("yaml" , "storage" , "filesystems" , 0 , "label" ), path .New ("json" , "storage" , "filesystems" , 0 , "label" )},
229
+ {path .New ("yaml" , "storage" , "filesystems" , 0 , "wipe_filesystem" ), path .New ("json" , "storage" , "filesystems" , 0 , "wipeFilesystem" )},
230
+ {path .New ("yaml" , "storage" , "filesystems" , 0 ), path .New ("json" , "storage" , "filesystems" , 0 )},
231
+ {path .New ("yaml" , "storage" , "filesystems" ), path .New ("json" , "storage" , "filesystems" )},
232
+ {path .New ("yaml" , "storage" ), path .New ("json" , "storage" )},
233
+ },
234
+ report.Report {
235
+ Entries : []report.Entry {
236
+ {
237
+ Kind : report .Warn ,
238
+ Message : common .ErrRootTooSmall .Error (),
239
+ Context : path .New ("json" , "storage" , "disks" , 0 , "partitions" , 0 , "sizeMiB" , 500 ),
240
+ },
241
+ },
242
+ },
243
+ },
244
+ // root partition constrained
245
+ {
246
+ Config {
247
+ Config : base.Config {
248
+ Storage : base.Storage {
249
+ Disks : []base.Disk {
250
+ {
251
+ Device : "/dev/vda" ,
252
+ Partitions : []base.Partition {
253
+ {
254
+ Label : util .StrToPtr ("root" ),
255
+ SizeMiB : util .IntToPtr (10000 ),
256
+ Resize : util .BoolToPtr (true ),
257
+ Number : 4 ,
258
+ },
259
+ {
260
+ Label : util .StrToPtr ("var-home" ),
261
+ SizeMiB : util .IntToPtr (10240 ),
262
+ Number : 5 ,
263
+ },
264
+ },
265
+ },
266
+ },
267
+ Filesystems : []base.Filesystem {
268
+ {
269
+ Device : "/dev/disk/by-partlabel/var-home" ,
270
+ Format : util .StrToPtr ("xfs" ),
271
+ Path : util .StrToPtr ("/var/home" ),
272
+ Label : util .StrToPtr ("var-home" ),
273
+ WipeFilesystem : util .BoolToPtr (false ),
274
+ },
275
+ },
276
+ },
277
+ },
278
+ },
279
+ types.Config {
280
+ Ignition : types.Ignition {
281
+ Version : "3.4.0-experimental" ,
282
+ },
283
+ Storage : types.Storage {
284
+ Disks : []types.Disk {
285
+ {
286
+ Device : "/dev/vda" ,
287
+ Partitions : []types.Partition {
288
+ {
289
+ Label : util .StrToPtr ("root" ),
290
+ SizeMiB : util .IntToPtr (10000 ),
291
+ Resize : util .BoolToPtr (true ),
292
+ Number : 4 ,
293
+ },
294
+ {
295
+ Label : util .StrToPtr ("var-home" ),
296
+ SizeMiB : util .IntToPtr (10240 ),
297
+ Number : 5 ,
298
+ },
299
+ },
300
+ },
301
+ },
302
+ Filesystems : []types.Filesystem {
303
+ {
304
+ Device : "/dev/disk/by-partlabel/var-home" ,
305
+ Format : util .StrToPtr ("xfs" ),
306
+ Path : util .StrToPtr ("/var/home" ),
307
+ Label : util .StrToPtr ("var-home" ),
308
+ WipeFilesystem : util .BoolToPtr (false ),
309
+ },
310
+ },
311
+ },
312
+ },
313
+ []translate.Translation {
314
+ {path .New ("yaml" , "version" ), path .New ("json" , "ignition" , "version" )},
315
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 0 , "label" ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 0 , "label" )},
316
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 0 , "size_mib" ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 0 , "sizeMiB" )},
317
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 0 , "resize" ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 0 , "resize" )},
318
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 1 , "label" ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 1 , "label" )},
319
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 1 , "size_mib" ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 1 , "sizeMiB" )},
320
+ {path .New ("yaml" , "storage" , "disks" , 0 , "partitions" , 0 ), path .New ("json" , "storage" , "disks" , 0 , "partitions" , 0 )},
321
+ {path .New ("yaml" , "storage" , "disks" , 0 ), path .New ("json" , "storage" , "disks" , 0 )},
322
+ {path .New ("yaml" , "storage" , "filesystems" , 0 , "device" ), path .New ("json" , "storage" , "filesystems" , 0 , "device" )},
323
+ {path .New ("yaml" , "storage" , "filesystems" , 0 , "format" ), path .New ("json" , "storage" , "filesystems" , 0 , "format" )},
324
+ {path .New ("yaml" , "storage" , "filesystems" , 0 , "path" ), path .New ("json" , "storage" , "filesystems" , 0 , "path" )},
325
+ {path .New ("yaml" , "storage" , "filesystems" , 0 , "label" ), path .New ("json" , "storage" , "filesystems" , 0 , "label" )},
326
+ {path .New ("yaml" , "storage" , "filesystems" , 0 , "wipe_filesystem" ), path .New ("json" , "storage" , "filesystems" , 0 , "wipeFilesystem" )},
327
+ {path .New ("yaml" , "storage" , "filesystems" , 0 ), path .New ("json" , "storage" , "filesystems" , 0 )},
328
+ {path .New ("yaml" , "storage" , "filesystems" ), path .New ("json" , "storage" , "filesystems" )},
329
+ {path .New ("yaml" , "storage" ), path .New ("json" , "storage" )},
330
+ },
331
+ report.Report {
332
+ Entries : []report.Entry {
333
+ {
334
+ Kind : report .Warn ,
335
+ Message : common .ErrRootNotLastPartition .Error (),
336
+ Context : path .New ("json" , "storage" , "disks" , 0 , "partitions" , 0 , "number" , 4 ),
337
+ },
338
+ },
339
+ },
340
+ },
149
341
// LUKS, x86_64
150
342
{
151
343
Config {
0 commit comments