github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/provider/common/disk.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package common
     5  
     6  import "github.com/juju/juju/core/os/ostype"
     7  
     8  // MinRootDiskSizeGiB is the minimum size for the root disk of an
     9  // instance, in Gigabytes. This value accommodates the anticipated
    10  // size of the initial image, any updates, and future application
    11  // data.
    12  func MinRootDiskSizeGiB(_ ostype.OSType) uint64 {
    13  	return 8
    14  }
    15  
    16  // MiBToGiB converts the provided megabytes (base-2) into the nearest
    17  // gigabytes (base-2), rounding up. This is useful for providers that
    18  // deal in gigabytes (while juju deals in megabytes).
    19  func MiBToGiB(m uint64) uint64 {
    20  	return (m + 1023) / 1024
    21  }