blueprint: add filesystem minsize function

This commit is contained in:
Gianluca Zuccarelli 2021-07-20 12:06:18 +01:00 committed by Tom Gundersen
parent 7408be580c
commit 90733e79f3

View file

@ -200,3 +200,19 @@ func (c *Customizations) GetFilesystems() []FilesystemCustomization {
}
return c.Filesystem
}
func (c *Customizations) GetFilesystemsMinSize() uint64 {
if c == nil {
return 0
}
agg := 0
for _, m := range c.Filesystem {
agg += m.MinSize
}
// This ensures that file system customization `size` is a multiple of
// sector size (512)
if agg%512 != 0 {
agg = (agg/512 + 1) * 512
}
return uint64(agg)
}