github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/storage/volume.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package storage
     5  
     6  import "gopkg.in/juju/names.v2"
     7  
     8  // Volume identifies and describes a volume (disk, logical volume, etc.)
     9  type Volume struct {
    10  	// Name is a unique name assigned by Juju to the volume.
    11  	Tag names.VolumeTag
    12  
    13  	VolumeInfo
    14  }
    15  
    16  // VolumeInfo describes a volume (disk, logical volume etc.)
    17  type VolumeInfo struct {
    18  	// VolumeId is a unique provider-supplied ID for the volume.
    19  	// VolumeId is required to be unique for the lifetime of the
    20  	// volume, but may be reused.
    21  	VolumeId string
    22  
    23  	// HardwareId is the volume's hardware ID. Not all volumes have
    24  	// a hardware ID, so this may be left blank.
    25  	HardwareId string
    26  
    27  	// Size is the size of the volume, in MiB.
    28  	Size uint64
    29  
    30  	// Persistent reflects whether the volume is destroyed with the
    31  	// machine to which it is attached.
    32  	Persistent bool
    33  }
    34  
    35  // VolumeAttachment identifies and describes machine-specific volume
    36  // attachment information, including how the volume is exposed on the
    37  // machine.
    38  type VolumeAttachment struct {
    39  	// Volume is the unique tag assigned by Juju for the volume
    40  	// that this attachment corresponds to.
    41  	Volume names.VolumeTag
    42  
    43  	// Machine is the unique tag assigned by Juju for the machine that
    44  	// this attachment corresponds to.
    45  	Machine names.MachineTag
    46  
    47  	VolumeAttachmentInfo
    48  }
    49  
    50  // VolumeAttachmentInfo describes machine-specific volume attachment
    51  // information, including how the volume is exposed on the machine.
    52  type VolumeAttachmentInfo struct {
    53  	// DeviceName is the volume's OS-specific device name (e.g. "sdb").
    54  	//
    55  	// If the device name may change (e.g. on machine restart), then this
    56  	// field must be left blank.
    57  	DeviceName string
    58  
    59  	// DeviceLink is an OS-specific device link that must exactly match
    60  	// one of the block device's links when attached.
    61  	//
    62  	// If no device link is known, or it may change (e.g. on machine
    63  	// restart), then this field must be left blank.
    64  	DeviceLink string
    65  
    66  	// BusAddress is the bus address, where the volume is attached to
    67  	// the machine.
    68  	//
    69  	// The format of this field must match the field of the same name
    70  	// in BlockDevice.
    71  	BusAddress string
    72  
    73  	// ReadOnly signifies whether the volume is read only or writable.
    74  	ReadOnly bool
    75  }