本文整理匯總了Golang中github.com/juju/juju/state.Machine.MachineTag方法的典型用法代碼示例。如果您正苦於以下問題:Golang Machine.MachineTag方法的具體用法?Golang Machine.MachineTag怎麽用?Golang Machine.MachineTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/state.Machine
的用法示例。
在下文中一共展示了Machine.MachineTag方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: constructImageConstraint
// constructImageConstraint returns model-specific criteria used to look for image metadata.
func (p *ProvisionerAPI) constructImageConstraint(m *state.Machine) (*imagemetadata.ImageConstraint, environs.Environ, error) {
// If we can determine current region,
// we want only metadata specific to this region.
cloud, env, err := p.obtainEnvCloudConfig()
if err != nil {
return nil, nil, errors.Trace(err)
}
lookup := simplestreams.LookupParams{
Series: []string{m.Series()},
Stream: env.Config().ImageStream(),
}
mcons, err := m.Constraints()
if err != nil {
return nil, nil, errors.Annotatef(err, "cannot get machine constraints for machine %v", m.MachineTag().Id())
}
if mcons.Arch != nil {
lookup.Arches = []string{*mcons.Arch}
}
if cloud != nil {
lookup.CloudSpec = *cloud
}
return imagemetadata.NewImageConstraint(lookup), env, nil
}
示例2: setKeys
func (s *SSHCommonSuite) setKeys(c *gc.C, m *state.Machine) {
id := m.Id()
keys := state.SSHHostKeys{"dsa-" + id, "rsa-" + id}
err := s.State.SetSSHHostKeys(m.MachineTag(), keys)
c.Assert(err, jc.ErrorIsNil)
}