本文整理汇总了Golang中github.com/juju/juju/state.StatusGetter类的典型用法代码示例。如果您正苦于以下问题:Golang StatusGetter类的具体用法?Golang StatusGetter怎么用?Golang StatusGetter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StatusGetter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: createStorageDetails
func createStorageDetails(st storageAccess, si state.StorageInstance) (*params.StorageDetails, error) {
// Get information from underlying volume or filesystem.
var persistent bool
var statusEntity state.StatusGetter
if si.Kind() != state.StorageKindBlock {
// TODO(axw) when we support persistent filesystems,
// e.g. CephFS, we'll need to do set "persistent"
// here too.
filesystem, err := st.StorageInstanceFilesystem(si.StorageTag())
if err != nil {
return nil, errors.Trace(err)
}
statusEntity = filesystem
} else {
volume, err := st.StorageInstanceVolume(si.StorageTag())
if err != nil {
return nil, errors.Trace(err)
}
if info, err := volume.Info(); err == nil {
persistent = info.Persistent
}
statusEntity = volume
}
status, err := statusEntity.Status()
if err != nil {
return nil, errors.Trace(err)
}
// Get unit storage attachments.
var storageAttachmentDetails map[string]params.StorageAttachmentDetails
storageAttachments, err := st.StorageAttachments(si.StorageTag())
if err != nil {
return nil, errors.Trace(err)
}
if len(storageAttachments) > 0 {
storageAttachmentDetails = make(map[string]params.StorageAttachmentDetails)
for _, a := range storageAttachments {
machineTag, location, err := storageAttachmentInfo(st, a)
if err != nil {
return nil, errors.Trace(err)
}
details := params.StorageAttachmentDetails{
a.StorageInstance().String(),
a.Unit().String(),
machineTag.String(),
location,
}
storageAttachmentDetails[a.Unit().String()] = details
}
}
return ¶ms.StorageDetails{
StorageTag: si.Tag().String(),
OwnerTag: si.Owner().String(),
Kind: params.StorageKind(si.Kind()),
Status: common.EntityStatusFromState(status),
Persistent: persistent,
Attachments: storageAttachmentDetails,
}, nil
}
开发者ID:imoapps,项目名称:juju,代码行数:60,代码来源:storage.go
示例2: populateStatusFromGetter
// populateStatusFromGetter creates status information for machines, units.
func populateStatusFromGetter(agent *params.AgentStatus, getter state.StatusGetter) {
statusInfo, err := getter.Status()
agent.Err = err
agent.Status = params.Status(statusInfo.Status)
agent.Info = statusInfo.Message
agent.Data = filterStatusData(statusInfo.Data)
agent.Since = statusInfo.Since
}
开发者ID:imoapps,项目名称:juju,代码行数:9,代码来源:status.go
示例3: makeStatusForEntity
// makeStatusForEntity creates status information for machines, units.
func makeStatusForEntity(agent *api.AgentStatus, getter state.StatusGetter) {
statusInfo, err := getter.Status()
agent.Err = err
agent.Status = params.Status(statusInfo.Status)
agent.Info = statusInfo.Message
agent.Data = filterStatusData(statusInfo.Data)
agent.Since = statusInfo.Since
}
开发者ID:vonwenm,项目名称:juju,代码行数:9,代码来源:status.go
注:本文中的github.com/juju/juju/state.StatusGetter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论