本文整理匯總了Golang中github.com/juju/juju/constraints.Value.RootDisk方法的典型用法代碼示例。如果您正苦於以下問題:Golang Value.RootDisk方法的具體用法?Golang Value.RootDisk怎麽用?Golang Value.RootDisk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/constraints.Value
的用法示例。
在下文中一共展示了Value.RootDisk方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: constraints
func (i *importer) constraints(cons description.Constraints) constraints.Value {
var result constraints.Value
if cons == nil {
return result
}
if arch := cons.Architecture(); arch != "" {
result.Arch = &arch
}
if container := instance.ContainerType(cons.Container()); container != "" {
result.Container = &container
}
if cores := cons.CpuCores(); cores != 0 {
result.CpuCores = &cores
}
if power := cons.CpuPower(); power != 0 {
result.CpuPower = &power
}
if inst := cons.InstanceType(); inst != "" {
result.InstanceType = &inst
}
if mem := cons.Memory(); mem != 0 {
result.Mem = &mem
}
if disk := cons.RootDisk(); disk != 0 {
result.RootDisk = &disk
}
if spaces := cons.Spaces(); len(spaces) > 0 {
result.Spaces = &spaces
}
if tags := cons.Tags(); len(tags) > 0 {
result.Tags = &tags
}
return result
}
示例2: TestBuildMAASVolumeParametersJustRootDisk
func (s *volumeSuite) TestBuildMAASVolumeParametersJustRootDisk(c *gc.C) {
var cons constraints.Value
rootSize := uint64(20000)
cons.RootDisk = &rootSize
vInfo, err := buildMAASVolumeParameters(nil, cons)
c.Assert(err, jc.ErrorIsNil)
c.Assert(vInfo, jc.DeepEquals, []volumeInfo{
{"root", 20, nil},
})
}
示例3: TestBuildMAASVolumeParametersWithRootDisk
func (s *volumeSuite) TestBuildMAASVolumeParametersWithRootDisk(c *gc.C) {
var cons constraints.Value
rootSize := uint64(20000)
cons.RootDisk = &rootSize
vInfo, err := buildMAASVolumeParameters([]storage.VolumeParams{
{Tag: names.NewVolumeTag("1"), Size: 2000000},
}, cons)
c.Assert(err, jc.ErrorIsNil)
c.Assert(vInfo, jc.DeepEquals, []volumeInfo{
{"root", 20, nil}, //root disk
{"1", 1954, nil},
})
}
示例4: TestConstraints
func (s *constraintsSuite) TestConstraints(c *gc.C) {
for i, t := range newConstraintTests {
var cv constraints.Value
if t.arch != nil {
cv.Arch = &t.arch.v
}
if t.cores != nil {
cv.CpuCores = &t.cores.v
}
if t.power != nil {
cv.CpuPower = &t.power.v
}
if t.mem != nil {
cv.Mem = &t.mem.v
}
if t.disk != nil {
cv.RootDisk = &t.disk.v
}
v := newConstraints(t.bootstrap, cv, img)
if !c.Check(*v, gc.Equals, t.expected) {
c.Logf("test (%d): %+v", i, t)
}
}
}