Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 371 lines (368 sloc) 11.351 kb
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
1 open Types
2
3 let api =
4 let vdi_info =
5 Type.(Struct(
9b2bac2 @djs55 Add per-field descriptions on the struct definitions
authored
6 ( "vdi", Basic String, "The unique id of this VDI" ),
7 [ "sr", Basic String, "The SR containing this VDI";
8 "content_id", Basic String, "The unique id of the VDI contents. If two VDIs have the same content_id then they must have the same data inside";
9 "name_label", Basic String, "Human-readable name of the VDI";
10 "name_description", Basic String, "Human-readable description of the VDI";
11 "ty", Basic String, "Used by a toolstack to remember why a VDI was created";
12 "metadata_of_pool", Basic String, "In the special case of a pool metadata containing VDI, this is the pool reference";
13 "is_a_snapshot", Basic Boolean, "True if the VDI is a snapshot of another VDI";
14 "snapshot_time", Basic String, "If is_a_snapshot is true then this is the time the snapshot was created";
15 "snapshot_of", Basic String, "If is_a_snapshot is true then this is the VDI which was snapshotted";
16 "read_only", Basic Boolean, "If true then this VDI is stored on read-only media";
17 "virtual_size", Basic Int64, "Size of the VDI from the perspective of a VM (in bytes)";
18 "physical_utilisation", Basic Int64, "Amount of space currently being consumed on the physical storage media";
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
19 ]
20 )) in
21 let sr = {
22 Arg.name = "sr";
23 ty = Type.(Basic String);
24 description = "The Storage Repository to operate within";
25 } in
26 let vdi = {
27 Arg.name = "vdi";
28 ty = Type.(Basic String);
29 description = "The Virtual Disk Image to operate on";
30 } in
31 let vdi_info' = {
32 Arg.name = "vdi_info";
4e77f09 @djs55 Fix lookup of named types within an environment. Note all types are curr...
authored
33 (* ty = vdi_info; *)
34 ty = Type.Name "vdi_info";
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
35 description = "The Virtual Disk Image properties";
36 } in
37 let params = {
38 Arg.name = "params";
39 ty = Type.(Dict(String, Basic String));
40 description = "Additional key/value pairs";
41 } in
42 {
43 Interfaces.name = "SMAPIv2";
7161ddd @djs55 Generate a nice index.html
authored
44 title = "Storage Manager";
318abf0 @djs55 Auto-generate the navbar index
authored
45 description = "The Storage Manager (SM) is responsible for all storage operations on an XCP host. It organises Virtual Disk Images (VDIs) into homogenous collections known as Storage Repositories (SRs) where each collection is stored in a specific format (e.g. .vhd files on NFS, raw LUN on a iSCSI/FC storage array). The Storage Manager API (SMAPI) provides a simple abstract interface which allows the toolstack to create, destroy, snapshot, clone, resize etc VDIs within SRs";
f1add48 @djs55 Start adding type declarations
authored
46 type_decls = [ { TyDecl.name = "vdi_info";
47 description = "All per-VDI properties";
48 ty = vdi_info
49 } ];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
50 interfaces =
51 [
52 {
53 Interface.name = "VDI";
54 description = "Operations which operate on Virtual Disk Images";
f1add48 @djs55 Start adding type declarations
authored
55 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
56 methods = [
57 {
58 Method.name = "create";
59 description = "[create task sr vdi_info params] creates a new VDI in [sr] using [vdi_info]. Some fields in the [vdi_info] may be modified (e.g. rounded up), so the function returns the vdi_info which was used.";
60 inputs = [
61 sr;
62 vdi_info';
63 params;
64 ];
65 outputs = [
66 { Arg.name = "new_vdi";
67 ty = vdi_info;
68 description = "The created Virtual Disk Image";
69 }
70 ];
71 }; {
72 Method.name = "snapshot";
73 description = "[snapshot task sr vdi vdi_info params] creates a new VDI which is a snapshot of [vdi] in [sr]";
74 inputs = [
75 sr;
76 vdi;
77 vdi_info';
78 params;
79 ];
80 outputs = [
81 { Arg.name = "new_vdi";
82 ty = vdi_info;
83 description = "[snapshot task sr vdi vdi_info params] creates a new VDI which is a snapshot of [vdi] in [sr]";
84 }
85 ];
86 }; {
87 Method.name = "clone";
88 description = "[clone task sr vdi vdi_info params] creates a new VDI which is a clone of [vdi] in [sr]";
89 inputs = [
90 sr;
91 vdi;
92 vdi_info';
93 params;
94 ];
95 outputs = [
96 { Arg.name = "new_vdi";
97 ty = vdi_info;
98 description = "[clone task sr vdi vdi_info params] creates a new VDI which is a clone of [vdi] in [sr]";
99 }
100 ];
101 }; {
102 Method.name = "destroy";
103 description = "[destroy task sr vdi] removes [vdi] from [sr]";
104 inputs = [
105 sr;
106 vdi;
107 ];
108 outputs = [
109 ];
110 }; {
111 Method.name = "attach";
112 description = "[attach task dp sr vdi read_write] returns the [params] for a given [vdi] in [sr] which can be written to if (but not necessarily only if) [read_write] is true";
113 inputs = [
114 { Arg.name = "dp";
115 ty = Type.(Basic String);
116 description = "DataPath to attach this VDI for";
117 };
118 sr;
119 vdi;
120 { Arg.name = "read_write";
121 ty = Type.(Basic Boolean);
122 description = "If true then the DataPath will be used read/write, false otherwise";
123 }
124 ];
125 outputs = [
126 { Arg.name = "params";
127 ty = Type.(Basic String);
128 description = "xenstore backend params key";
129 }
130 ];
131 }; {
132 Method.name = "activate";
133 description = "[activate task dp sr vdi] signals the desire to immediately use [vdi]. This client must have called [attach] on the [vdi] first.";
134 inputs = [
135 { Arg.name = "dp";
136 ty = Type.(Basic String);
137 description = "DataPath to attach this VDI for";
138 };
139 sr;
140 vdi;
141 ];
142 outputs = [
143 ];
144 }; {
145 Method.name = "deactivate";
146 description = "[deactivate task dp sr vdi] signals that this client has stopped reading (and writing) [vdi].";
147 inputs = [
148 { Arg.name = "dp";
149 ty = Type.(Basic String);
150 description = "DataPath to deactivate";
151 };
152 sr;
153 vdi;
154 ];
155 outputs = [
156 ];
157 }; {
158 Method.name = "detach";
159 description = "[detach task dp sr vdi] signals that this client no-longer needs the [params] to be valid.";
160 inputs = [
161 { Arg.name = "dp";
162 ty = Type.(Basic String);
163 description = "DataPath to detach";
164 };
165 sr;
166 vdi;
167 ];
168 outputs = [
169 ];
170 }; {
171 Method.name = "copy";
172 description = "[copy task sr vdi url sr2] copies the data from [vdi] into a remote system [url]'s [sr2]";
173 inputs = [
174 sr;
175 vdi;
176 { Arg.name = "url";
177 ty = Type.(Basic String);
178 description = "URL which identifies a remote system";
179 };
180 { sr with Arg.name = "dest" };
181 ];
182 outputs = [
183 { vdi with Arg.name = "new_vdi" }
184 ];
185 }; {
186 Method.name = "get_url";
187 description = "[get_url task sr vdi] returns a URL suitable for accessing disk data directly.";
188 inputs = [
189 sr;
190 vdi
191 ];
192 outputs = [
193 { Arg.name = "url";
194 ty = Type.(Basic String);
195 description = "URL which represents this VDI";
196 }
197 ];
198 }; {
199 Method.name = "get_by_name";
200 description = "[get_by_name task sr name] returns the vdi within [sr] with [name]";
201 inputs = [
202 sr;
203 { Arg.name = "name";
204 ty = Type.(Basic String);
205 description = "Name of the VDI to return";
206 };
207 ];
208 outputs = [
209 vdi
210 ];
211 }; {
212 Method.name = "set_content_id";
213 description = "[set_content_id task sr vdi content_id] tells the storage backend that a VDI has an updated [content_id]";
214 inputs = [
215 sr;
216 vdi;
217 { Arg.name = "content_id";
218 ty = Type.(Basic String);
219 description = "New value of the VDI content_id field";
220 }
221 ];
222 outputs = [
223 ];
224 }; {
225 Method.name = "compose";
226 description = "[compose task sr vdi1 vdi2] layers the updates from [vdi2] onto [vdi1], modifying [vdi2]";
227 inputs = [
228 sr;
229 { vdi with Arg.name = "vdi1" };
230 { vdi with Arg.name = "vdi2" };
231 ];
232 outputs = [
233 ];
234 }
235
236 ]
237 }; {
238 Interface.name = "SR";
239 description = "Operations which act on Storage Repositories";
f1add48 @djs55 Start adding type declarations
authored
240 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
241 methods = [
242 {
243 Method.name = "attach";
244 description = "[attach task sr]: attaches the SR";
245 inputs = [
246 sr;
247 { Arg.name = "device_config";
248 ty = Type.(Dict(String, Basic String));
249 description = "Host-local SR configuration (e.g. address information)";
250 };
251 ];
252 outputs = [
253 ];
254 }; {
255 Method.name = "detach";
256 description = "[detach task sr]: detaches the SR, first detaching and/or deactivating any active VDIs. This may fail with Sr_not_attached, or any error from VDI.detach or VDI.deactivate.";
257 inputs = [
258 sr;
259 ];
260 outputs = [
261 ];
262 }; {
263 Method.name = "destroy";
264 description = "[destroy sr]: destroys (i.e. makes unattachable and unprobeable) the [sr], first detaching and/or deactivating any active VDIs. This may fail with Sr_not_attached, or any error from VDI.detach or VDI.deactivate.";
265 inputs = [
266 sr;
267 ];
268 outputs = [
269 ];
270 }; {
271 Method.name = "reset";
272 description = "[reset task sr]: declares that the SR has been completely reset, e.g. by rebooting the VM hosting the SR backend.";
273 inputs = [
274 sr;
275 ];
276 outputs = [
277 ];
278 }; {
279 Method.name = "scan";
280 description = "[scan task sr] returns a list of VDIs contained within an attached SR";
281 inputs = [
282 sr;
283 ];
284 outputs = [
285 (* XXX: vdi_info list *)
286 ];
287 }
288 ]
289 }; {
290 Interface.name = "DP";
291 description = "Operations which act on DataPaths";
f1add48 @djs55 Start adding type declarations
authored
292 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
293 methods = [
294 {
295 Method.name = "create";
296 description = "[create task id]: creates and returns a dp";
297 inputs = [
298 { Arg.name = "id";
299 ty = Type.(Basic String);
300 description = "Human-readable DataPath name, for logging and diagnostics";
301 }
302 ];
303 outputs = [
304 { Arg.name = "id";
305 ty = Type.(Basic String);
306 description = "Abstract DataPath identifier";
307 }
308 ];
309 }; {
310 Method.name = "destroy";
311 description = "[destroy task id]: frees any resources associated with [id] and destroys it. This will typically do any needed VDI.detach, VDI.deactivate cleanup.";
312 inputs = [
313 { Arg.name = "id";
314 ty = Type.(Basic String);
315 description = "Abstract DataPath identifier";
316 }; {
317 Arg.name = "allow_leak";
318 ty = Type.(Basic Boolean);
319 description = "If true then a failure will be logged but the call will not fail";
320 }
321 ];
322 outputs = [
323 ];
324 }; {
325 Method.name = "diagnostics";
326 description = "[diagnostics ()]: returns a printable set of diagnostic information, typically including lists of all registered datapaths and their allocated resources.";
327 inputs = [
328 ];
329 outputs = [
330 { Arg.name = "diagnostics";
331 ty = Type.(Basic String);
332 description = "A string containing loggable human-readable diagnostics information";
333 }
334 ];
335 }
336 ]
337 }; {
338 Interface.name = "Mirror";
339 description = "Operations which act on disk mirrors.";
f1add48 @djs55 Start adding type declarations
authored
340 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
341 methods = [
342 {
343 Method.name = "start";
344 description = "[start task sr vdi url sr2] creates a VDI in remote [url]'s [sr2] and writes data synchronously. It returns the id of the VDI.";
345 inputs = [
346 sr;
347 vdi;
348 { Arg.name = "url";
349 ty = Type.(Basic String);
350 description = "The URL to mirror the VDI to";
351 };
352 { sr with Arg.name = "dest" }
353 ];
354 outputs = [
355 { vdi with Arg.name = "new_vdi" }
356 ];
357 }; {
358 Method.name = "stop";
359 description = "[stop task sr vdi] stops mirroring local [vdi]";
360 inputs = [
361 sr;
362 vdi;
363 ];
364 outputs = [
365 ];
366 }
367 ]
368 }
369 ]
370 }
Something went wrong with that request. Please try again.