forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage-model.txt
212 lines (183 loc) · 4.71 KB
/
storage-model.txt
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
@startuml
hide circle
hide empty methods
hide empty fields
namespace juju.charm {
class StorageMetadata {
Name: string
Description : string
Kind : StorageKind
ReadOnly : bool
Shared : bool
Location: string
CountMin : int
CountMax : int
}
enum StorageKind {
block
filesystem
}
Charm "1" *-- "*" StorageMetadata : specifies >
}
namespace juju.juju.state <<Database>> {
class Volume {
Id : string
Life : Life
Pool : string
Info : VolumeInfo
Params : VolumeParams
}
class VolumeInfo {
VolumeId : string
Size : int
Detachable : bool
ExtendedAttrs : map[string]interface{}
}
class VolumeParams {
Size : int
}
class VolumeAttachment {
DeviceName : string
}
class Filesystem {
Id : string
Life : Life
Pool : string
Info : FilesystemInfo
Params : FilesystemParams
}
class FilesystemInfo {
FilesystemId : string
Size : int
Detachable : bool
ExtendedAttrs : map[string]interface{}
}
class FilesystemParams {
Size : int
Location : string
}
class FilesystemAttachment {
MountPoint : string
}
class BlockDevice {
DeviceName : string
HardwareId : string
Size : int
FilesystemType : string
}
class StorageConstraints {
StorageName : string
Size : int
Count : int
Pool : StoragePool
}
class StoragePool {
Name : string
StorageProvider : string
Attributes : map[string]string
}
class StorageInstance {
Id : string
Pool : StoragePool
Life : Life
}
class StorageAttachment {
Location : string
}
Machine "1" *-- "*" BlockDevice : > has
Machine "1" *-- "*" VolumeAttachment : has >
Machine "1" *-- "*" FilesystemAttachment : has >
Unit "1" *-- "*" StorageInstance : owns (non-shared) >
Unit "1" *-- "*" StorageAttachment : has
Unit "1" *-- "*" StorageConstraints : records >
application "1" *-- "*" StorageInstance : owns (shared) >
application "1" *-- "*" StorageConstraints : records >
application "1" -- "1" juju.charm.Charm
StorageInstance --* StoragePool
StorageInstance "1" *-- "*" StorageAttachment : has >
Volume "1" *-- "0-1" StorageInstance : assigned >
Volume "1" *-- "*" VolumeAttachment
Volume "1" *-- "*" VolumeParams
Volume "1" *-- "*" VolumeInfo
Filesystem "1" *-- "0-1" StorageInstance : assigned to >
Filesystem "1" *-- "0-1" FilesystemAttachment : assigned to >
Filesystem "1" *-- "0-1" FilesystemParams
Filesystem "1" *-- "0-1" FilesystemInfo
note as N1
Non-shared storage instances
are owned by and managed by a
unit, shared storage instances
are owned by a service and managed
by a unit of that service with
with a lease.
end note
StorageInstance .. N1
note as N2
The machine agent will periodically list
block devices on the machine and publish
them to state. This gives us a mechanism
to determine when a volume is attached
and visible to a machine. Additioally,
users will later be able to create a
Volume from an unused BlockDevice, e.g.
hot-plugged disks in MAAS.
end note
BlockDevice .. N2
note as N3
Volumes and Filesystems will initially
be unprovisioned, and will have Params
documents associated. Once provisioned,
the Params are dropped and replaced with
Info. We don't currently, but may later
periodically update Info with, e.g.
currently available size.
end note
VolumeInfo .. N3
FilesystemInfo .. N3
VolumeParams .. N3
FilesystemParams .. N3
note as N4
StorageInstance represents a possibly
shared store, whereas a StorageAttachment
represents the storage instance's attachment
to a unit. For non-shared stores, there
will be a one-to-one relationship between
StorageInstance and StorageAttachment.
For shared stores, there may be multiple
units attached to a store, potentially with
different locations (e.g. block device paths,
filesystem mount points).
end note
StorageInstance .. N4
StorageAttachment .. N4
note as N5
Volumes and Filesystems may be multi-attachable,
hence we model attachment as well as the entity
itself. Each VolumeAttachment and
FilesystemAttachment may have different
machine-specific properties (e.g. device name,
filesystem mount point).
end note
Volume .. N5
VolumeAttachment .. N5
Filesystem .. N5
FilesystemAttachment .. N5
note as N6
Volumes and Filesystems may be persistent, and
so are not tied to a single storage instance
forever. For example, if we deploy a service
with persistent storage, and later destroy the
unit, we should later be able to reuse that
persistent storage with another unit to revive
the service.
end note
Volume .. N6
Filesystem .. N6
StorageInstance .. N6
}
namespace juju.names {
VolumeTag ..> juju.juju.state.Volume : identifies
FilesystemTag ..> juju.juju.state.Filesystem : identifies
StorageTag ..> juju.juju.state.StorageInstance : identifies
}
@enduml