本文整理汇总了Golang中github.com/juju/core/state.Machine.Id方法的典型用法代码示例。如果您正苦于以下问题:Golang Machine.Id方法的具体用法?Golang Machine.Id怎么用?Golang Machine.Id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/core/state.Machine
的用法示例。
在下文中一共展示了Machine.Id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: newAgent
// newAgent returns a new MachineAgent instance
func (s *commonMachineSuite) newAgent(c *gc.C, m *state.Machine) *MachineAgent {
a := &MachineAgent{}
s.initAgent(c, a, "--machine-id", m.Id())
err := a.ReadConfig(m.Tag())
c.Assert(err, gc.IsNil)
return a
}
示例2: checkStartInstanceCustom
func (s *CommonProvisionerSuite) checkStartInstanceCustom(c *gc.C, m *state.Machine, secret string, cons constraints.Value, includeNetworks, excludeNetworks []string, networkInfo []network.Info, waitInstanceId bool) (inst instance.Instance) {
s.BackingState.StartSync()
for {
select {
case o := <-s.op:
switch o := o.(type) {
case dummy.OpStartInstance:
inst = o.Instance
if waitInstanceId {
s.waitInstanceId(c, m, inst.Id())
}
// Check the instance was started with the expected params.
c.Assert(o.MachineId, gc.Equals, m.Id())
nonceParts := strings.SplitN(o.MachineNonce, ":", 2)
c.Assert(nonceParts, gc.HasLen, 2)
c.Assert(nonceParts[0], gc.Equals, names.MachineTag("0"))
c.Assert(nonceParts[1], jc.Satisfies, utils.IsValidUUIDString)
c.Assert(o.Secret, gc.Equals, secret)
c.Assert(o.IncludeNetworks, jc.DeepEquals, includeNetworks)
c.Assert(o.ExcludeNetworks, jc.DeepEquals, excludeNetworks)
c.Assert(o.NetworkInfo, jc.DeepEquals, networkInfo)
// All provisioned machines in this test suite have
// their hardware characteristics attributes set to
// the same values as the constraints due to the dummy
// environment being used.
if !constraints.IsEmpty(&cons) {
c.Assert(o.Constraints, gc.DeepEquals, cons)
hc, err := m.HardwareCharacteristics()
c.Assert(err, gc.IsNil)
c.Assert(*hc, gc.DeepEquals, instance.HardwareCharacteristics{
Arch: cons.Arch,
Mem: cons.Mem,
RootDisk: cons.RootDisk,
CpuCores: cons.CpuCores,
CpuPower: cons.CpuPower,
Tags: cons.Tags,
})
}
return
default:
c.Logf("ignoring unexpected operation %#v", o)
}
case <-time.After(2 * time.Second):
c.Fatalf("provisioner did not start an instance")
return
}
}
return
}
示例3: startInstance
// startInstance starts a new instance for the given machine.
func (s *FirewallerSuite) startInstance(c *gc.C, m *state.Machine) instance.Instance {
inst, hc := testing.AssertStartInstance(c, s.Conn.Environ, m.Id())
err := m.SetProvisioned(inst.Id(), "fake_nonce", hc)
c.Assert(err, gc.IsNil)
return inst
}
示例4: setAddresses
func (s *SSHCommonSuite) setAddresses(m *state.Machine, c *gc.C) {
addrPub := instance.NewAddress(fmt.Sprintf("dummyenv-%s.dns", m.Id()), instance.NetworkPublic)
addrPriv := instance.NewAddress(fmt.Sprintf("dummyenv-%s.internal", m.Id()), instance.NetworkCloudLocal)
err := m.SetAddresses(addrPub, addrPriv)
c.Assert(err, gc.IsNil)
}