예제 #1
0
파일: volumes.go 프로젝트: bac/juju
// VolumeAttachmentFromState converts a state.VolumeAttachment to params.VolumeAttachment.
func VolumeAttachmentFromState(v state.VolumeAttachment) (params.VolumeAttachment, error) {
	info, err := v.Info()
	if err != nil {
		return params.VolumeAttachment{}, errors.Trace(err)
	}
	return params.VolumeAttachment{
		v.Volume().String(),
		v.Machine().String(),
		VolumeAttachmentInfoFromState(info),
	}, nil
}
예제 #2
0
파일: storage.go 프로젝트: Pankov404/juju
func convertStateVolumeAttachmentToParams(attachment state.VolumeAttachment) params.VolumeAttachment {
	result := params.VolumeAttachment{
		VolumeTag:  attachment.Volume().String(),
		MachineTag: attachment.Machine().String()}
	if info, err := attachment.Info(); err == nil {
		result.Info = params.VolumeAttachmentInfo{
			info.DeviceName,
			info.ReadOnly,
		}
	}
	return result
}
예제 #3
0
파일: volumes.go 프로젝트: mhilton/juju
// VolumeAttachmentFromState converts a state.VolumeAttachment to params.VolumeAttachment.
func VolumeAttachmentFromState(v state.VolumeAttachment) (params.VolumeAttachment, error) {
	info, err := v.Info()
	if err != nil {
		return params.VolumeAttachment{}, errors.Trace(err)
	}
	return params.VolumeAttachment{
		v.Volume().String(),
		v.Machine().String(),
		params.VolumeAttachmentInfo{
			info.DeviceName,
			info.BusAddress,
			info.ReadOnly,
		},
	}, nil
}