本文整理汇总了Golang中github.com/juju/juju/core/description.Machine.Placement方法的典型用法代码示例。如果您正苦于以下问题:Golang Machine.Placement方法的具体用法?Golang Machine.Placement怎么用?Golang Machine.Placement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/core/description.Machine
的用法示例。
在下文中一共展示了Machine.Placement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: makeMachineDoc
func (i *importer) makeMachineDoc(m description.Machine) (*machineDoc, error) {
id := m.Id()
supported, supportedSet := m.SupportedContainers()
supportedContainers := make([]instance.ContainerType, len(supported))
for j, c := range supported {
supportedContainers[j] = instance.ContainerType(c)
}
jobs, err := i.makeMachineJobs(m.Jobs())
if err != nil {
return nil, errors.Trace(err)
}
return &machineDoc{
DocID: i.st.docID(id),
Id: id,
ModelUUID: i.st.ModelUUID(),
Nonce: m.Nonce(),
Series: m.Series(),
ContainerType: m.ContainerType(),
Principals: nil, // TODO
Life: Alive,
Tools: i.makeTools(m.Tools()),
Jobs: jobs,
NoVote: true, // State servers can't be migrated yet.
HasVote: false, // State servers can't be migrated yet.
PasswordHash: m.PasswordHash(),
Clean: true, // check this later
Addresses: i.makeAddresses(m.ProviderAddresses()),
MachineAddresses: i.makeAddresses(m.MachineAddresses()),
PreferredPrivateAddress: i.makeAddress(m.PreferredPrivateAddress()),
PreferredPublicAddress: i.makeAddress(m.PreferredPublicAddress()),
SupportedContainersKnown: supportedSet,
SupportedContainers: supportedContainers,
Placement: m.Placement(),
}, nil
}