Beispiel #1
0
// 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
}
Beispiel #2
0
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
}
Beispiel #3
0
// 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
}