本文整理汇总了Golang中github.com/juju/juju/provider/gce/google.DiskSpec.TooSmall方法的典型用法代码示例。如果您正苦于以下问题:Golang DiskSpec.TooSmall方法的具体用法?Golang DiskSpec.TooSmall怎么用?Golang DiskSpec.TooSmall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/provider/gce/google.DiskSpec
的用法示例。
在下文中一共展示了DiskSpec.TooSmall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getDisks
// getDisks builds the raw spec for the disks that should be attached to
// the new instances and returns it. This will always include a root
// disk with characteristics determined by the provides args and
// constraints.
func getDisks(spec *instances.InstanceSpec, cons constraints.Value, ser, eUUID string) ([]google.DiskSpec, error) {
size := common.MinRootDiskSizeGiB(ser)
if cons.RootDisk != nil && *cons.RootDisk > size {
size = common.MiBToGiB(*cons.RootDisk)
}
var imageURL string
os, err := series.GetOSFromSeries(ser)
if err != nil {
return nil, errors.Trace(err)
}
switch os {
case jujuos.Ubuntu:
imageURL = ubuntuImageBasePath
case jujuos.Windows:
imageURL = windowsImageBasePath
default:
return nil, errors.Errorf("os %s is not supported on the gce provider", os.String())
}
dSpec := google.DiskSpec{
Series: ser,
SizeHintGB: size,
ImageURL: imageURL + spec.Image.Id,
Boot: true,
AutoDelete: true,
Description: eUUID,
}
if cons.RootDisk != nil && dSpec.TooSmall() {
msg := "Ignoring root-disk constraint of %dM because it is smaller than the GCE image size of %dG"
logger.Infof(msg, *cons.RootDisk, google.MinDiskSizeGB(ser))
}
return []google.DiskSpec{dSpec}, nil
}
示例2: getDisks
// getDisks builds the raw spec for the disks that should be attached to
// the new instances and returns it. This will always include a root
// disk with characteristics determined by the provides args and
// constraints.
func getDisks(spec *instances.InstanceSpec, cons constraints.Value) []google.DiskSpec {
size := common.MinRootDiskSizeGiB
if cons.RootDisk != nil && *cons.RootDisk > size {
size = common.MiBToGiB(*cons.RootDisk)
}
dSpec := google.DiskSpec{
SizeHintGB: size,
ImageURL: imageBasePath + spec.Image.Id,
Boot: true,
AutoDelete: true,
}
if cons.RootDisk != nil && dSpec.TooSmall() {
msg := "Ignoring root-disk constraint of %dM because it is smaller than the GCE image size of %dG"
logger.Infof(msg, *cons.RootDisk, google.MinDiskSizeGB)
}
return []google.DiskSpec{dSpec}
}