forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
/
volume.go
115 lines (92 loc) · 3.5 KB
/
volume.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package storage
import "github.com/juju/names/v4"
type DeviceType string
var (
DeviceTypeLocal DeviceType = "local"
DeviceTypeISCSI DeviceType = "iscsi"
)
// Volume identifies and describes a volume (disk, logical volume, etc.)
type Volume struct {
// Name is a unique name assigned by Juju to the volume.
Tag names.VolumeTag
VolumeInfo
}
// VolumeInfo describes a volume (disk, logical volume etc.)
type VolumeInfo struct {
// VolumeId is a unique provider-supplied ID for the volume.
// VolumeId is required to be unique for the lifetime of the
// volume, but may be reused.
VolumeId string
// HardwareId is the volume's hardware ID. Not all volumes have
// a hardware ID, so this may be left blank.
HardwareId string
// WWN is the volume's World Wide Name (WWN). Not all volumes
// have a WWN, so this may be left blank.
WWN string
// Size is the size of the volume, in MiB.
Size uint64
// Persistent reflects whether the volume is destroyed with the
// machine to which it is attached.
Persistent bool
}
// VolumeAttachment identifies and describes machine-specific volume
// attachment information, including how the volume is exposed on the
// machine.
type VolumeAttachment struct {
// Volume is the unique tag assigned by Juju for the volume
// that this attachment corresponds to.
Volume names.VolumeTag
// Machine is the unique tag assigned by Juju for the machine that
// this attachment corresponds to.
Machine names.Tag
VolumeAttachmentInfo
}
type VolumeAttachmentPlan struct {
// Volume is the unique tag assigned by Juju for the volume
// that this attachment corresponds to.
Volume names.VolumeTag
// Machine is the unique tag assigned by Juju for the machine that
// this attachment corresponds to.
Machine names.MachineTag
VolumeAttachmentPlanInfo
}
type VolumeAttachmentPlanInfo struct {
// DeviceType describes what type of volume we are dealing with
// possible options are:
// * local - a block device that is directly attached to this instance
// * iscsi - an iSCSI disk. This type of disk will require the machine agent
// to execute additional steps before the device is available
DeviceType DeviceType
// DeviceAttributes is a map that contains DeviceType specific initialization
// values. For example, in the case of iscsi, it may contain server address:port,
// target, chap secrets, etc.
DeviceAttributes map[string]string
}
// VolumeAttachmentInfo describes machine-specific volume attachment
// information, including how the volume is exposed on the machine.
type VolumeAttachmentInfo struct {
// DeviceName is the volume's OS-specific device name (e.g. "sdb").
//
// If the device name may change (e.g. on machine restart), then this
// field must be left blank.
DeviceName string
// DeviceLink is an OS-specific device link that must exactly match
// one of the block device's links when attached.
//
// If no device link is known, or it may change (e.g. on machine
// restart), then this field must be left blank.
DeviceLink string
// BusAddress is the bus address, where the volume is attached to
// the machine.
//
// The format of this field must match the field of the same name
// in BlockDevice.
BusAddress string
// ReadOnly signifies whether the volume is read only or writable.
ReadOnly bool
// PlanInfo holds information that the machine agent might use to
// initialize the block device that has been attached to it.
PlanInfo *VolumeAttachmentPlanInfo
}