本文整理匯總了Golang中github.com/juju/juju/state.Filesystem.Status方法的典型用法代碼示例。如果您正苦於以下問題:Golang Filesystem.Status方法的具體用法?Golang Filesystem.Status怎麽用?Golang Filesystem.Status使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/state.Filesystem
的用法示例。
在下文中一共展示了Filesystem.Status方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: createFilesystemDetails
func createFilesystemDetails(
st storageAccess, f state.Filesystem, attachments []state.FilesystemAttachment,
) (*params.FilesystemDetails, error) {
details := ¶ms.FilesystemDetails{
FilesystemTag: f.FilesystemTag().String(),
}
if volumeTag, err := f.Volume(); err == nil {
details.VolumeTag = volumeTag.String()
}
if info, err := f.Info(); err == nil {
details.Info = storagecommon.FilesystemInfoFromState(info)
}
if len(attachments) > 0 {
details.MachineAttachments = make(map[string]params.FilesystemAttachmentInfo, len(attachments))
for _, attachment := range attachments {
stateInfo, err := attachment.Info()
var info params.FilesystemAttachmentInfo
if err == nil {
info = storagecommon.FilesystemAttachmentInfoFromState(stateInfo)
}
details.MachineAttachments[attachment.Machine().String()] = info
}
}
status, err := f.Status()
if err != nil {
return nil, errors.Trace(err)
}
details.Status = common.EntityStatusFromState(status)
if storageTag, err := f.Storage(); err == nil {
storageInstance, err := st.StorageInstance(storageTag)
if err != nil {
return nil, errors.Trace(err)
}
storageDetails, err := createStorageDetails(st, storageInstance)
if err != nil {
return nil, errors.Trace(err)
}
details.Storage = storageDetails
}
return details, nil
}