Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 498 lines (495 sloc) 15.591 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(
44d5a0d @djs55 Update the SMAPIv2, remove Mirror for now
authored
6 ( "vdi", Name "vdi", "The unique id of this VDI" ),
ba3a1d0 @djs55 [smapiv2] remove "SR" from vdi_info to match xen-api 36b0a279c30962aaa7f...
authored
7 [ "content_id", Name "content_id", "The unique id of the VDI contents. If two VDIs have the same content_id then they must have the same data inside";
9b2bac2 @djs55 Add per-field descriptions on the struct definitions
authored
8 "name_label", Basic String, "Human-readable name of the VDI";
9 "name_description", Basic String, "Human-readable description of the VDI";
10 "ty", Basic String, "Used by a toolstack to remember why a VDI was created";
11 "metadata_of_pool", Basic String, "In the special case of a pool metadata containing VDI, this is the pool reference";
12 "is_a_snapshot", Basic Boolean, "True if the VDI is a snapshot of another VDI";
13 "snapshot_time", Basic String, "If is_a_snapshot is true then this is the time the snapshot was created";
14 "snapshot_of", Basic String, "If is_a_snapshot is true then this is the VDI which was snapshotted";
15 "read_only", Basic Boolean, "If true then this VDI is stored on read-only media";
16 "virtual_size", Basic Int64, "Size of the VDI from the perspective of a VM (in bytes)";
17 "physical_utilisation", Basic Int64, "Amount of space currently being consumed on the physical storage media";
826505e @djs55 fs: add support for non-persistent disks
authored
18 "persistent", Basic Boolean, "If true then disk modifications are preserved over VM reboot and shutdown";
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
44d5a0d @djs55 Update the SMAPIv2, remove Mirror for now
authored
31 let attach_info =
32 Type.(Struct(
33 ( "params", Basic String, "The xenstore backend params key"),
34 [ "xenstore_data", Dict(String, Basic String), "Additional xenstore backend device keys" ]
35 )) in
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
36 let vdi_info' = {
37 Arg.name = "vdi_info";
4e77f09 @djs55 Fix lookup of named types within an environment. Note all types are curr...
authored
38 (* ty = vdi_info; *)
39 ty = Type.Name "vdi_info";
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
40 description = "The Virtual Disk Image properties";
41 } in
42 let params = {
43 Arg.name = "params";
44 ty = Type.(Dict(String, Basic String));
45 description = "Additional key/value pairs";
46 } in
47 {
329da8c @djs55 Rename services for uniformity
authored
48 Interfaces.name = "storage";
7161ddd @djs55 Generate a nice index.html
authored
49 title = "Storage Manager";
318abf0 @djs55 Auto-generate the navbar index
authored
50 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";
29a5730 @djs55 smapiv2: add declarations for exceptions
authored
51 exn_decls = [
52 {
53 TyDecl.name = "Sr_not_attached";
54 description = "An SR must be attached in order to access VDIs";
5003d42 @djs55 smapiv2: update to match Sr_not_attached arity change in xen-api
authored
55 ty = Type.(Basic String)
29a5730 @djs55 smapiv2: add declarations for exceptions
authored
56 }; {
57 TyDecl.name = "Vdi_does_not_exist";
58 description = "The specified VDI could not be found in the SR";
1e67712 @djs55 smapiv2: update following Vdi_does_not_exist arity-change in xen-api
authored
59 ty = Type.(Basic String)
29a5730 @djs55 smapiv2: add declarations for exceptions
authored
60 }; {
61 TyDecl.name = "Illegal_transition";
62 description = "The requested VDI state transition is invalid";
63 ty = Type.(Pair(Basic String, Basic String))
64 }; {
65 TyDecl.name = "Backend_error";
66 description = "A backend-specific error occurred";
67 ty = Type.(Pair(Basic String, Array (Basic String)));
68 }; {
69 TyDecl.name = "Unimplemented";
70 description = "The operation has not been implemented";
70f0cd8 @djs55 Fix exception marshalling
authored
71 ty = Type.(Basic String);
29a5730 @djs55 smapiv2: add declarations for exceptions
authored
72 }; {
73 TyDecl.name = "Does_not_exist";
74 description = "The object does not exist";
75 ty = Type.(Pair(Basic String, Basic String));
76 }; {
77 TyDecl.name = "Cancelled";
78 description = "The task has been asynchronously cancelled";
79 ty = Type.(Basic String);
80 }; {
81 TyDecl.name = "Redirect";
82 description = "The request should be resent to this address";
83 ty = Type.(Basic String);
84 }; {
85 TyDecl.name = "Sr_attached";
86 description = "The operation cannot be performed because the SR is still attached";
1e67712 @djs55 smapiv2: update following Vdi_does_not_exist arity-change in xen-api
authored
87 ty = Type.(Basic String)
29a5730 @djs55 smapiv2: add declarations for exceptions
authored
88 }
89 ];
44d5a0d @djs55 Update the SMAPIv2, remove Mirror for now
authored
90 type_decls = [
91 {
92 TyDecl.name = "vdi";
93 description = "Primary key for a Virtual Disk Image (e.g. path on a storage system)";
94 ty = Type.(Basic String);
95 }; {
96 TyDecl.name = "sr";
97 description = "Primary key for a Storage Repository (e.g. a UUID)";
98 ty = Type.(Basic String);
99 }; {
100 TyDecl.name = "content_id";
101 description = "Identifies the contents (i.e. bytes with) a VDI. Two VDIs with the same content_id must have the same content.";
102 ty = Type.(Basic String);
103 }; {
104 TyDecl.name = "vdi_info";
105 description = "All per-VDI properties";
106 ty = vdi_info
107 };
108 ];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
109 interfaces =
110 [
66cc2d4 @djs55 smapiv2: move "query" into the module "Query" for consistency with xenop...
authored
111 {
112 Interface.name = "Query";
113 description = "Discover properties of this implementation";
114 type_decls = [
115 {
116 TyDecl.name = "query_result";
117 description = "properties of this implementation";
1381e33 @djs55 smapiv2: update query_result to match xen-api change
authored
118 ty = Type.(Struct( ("driver", Basic String, "driver, used in the XenAPI as SR.type"), [
119 "name", Basic String, "short name";
120 "description", Basic String, "description";
66cc2d4 @djs55 smapiv2: move "query" into the module "Query" for consistency with xenop...
authored
121 "vendor", Basic String, "entity which produced this implementation";
1381e33 @djs55 smapiv2: update query_result to match xen-api change
authored
122 "copyright", Basic String, "copyright";
66cc2d4 @djs55 smapiv2: move "query" into the module "Query" for consistency with xenop...
authored
123 "version", Basic String, "version";
1381e33 @djs55 smapiv2: update query_result to match xen-api change
authored
124 "required_api_version", Basic String, "minimum required API version";
125 "features", Array (Basic String), "features supported by this plugin";
126 "configuration", Dict(String, Basic String), "key/description pairs describing required device_config parameters"
66cc2d4 @djs55 smapiv2: move "query" into the module "Query" for consistency with xenop...
authored
127 ]))
128 }
129 ];
130 methods = [
131 {
132 Method.name = "query";
133 description = "Query the implementation and return its properties";
134 inputs = [];
135 outputs = [
136 {
137 Arg.name = "query_result";
138 ty = Type.Name "query_result";
139 description = "The properies of this implementation"
140 }
141 ]
d6a0d40 @djs55 smapiv2: add Query.diagnostics
authored
142 }; {
143 Method.name = "diagnostics";
144 description = "[diagnostics ()]: returns a printable set of backend diagnostic information.";
145 inputs = [
146 ];
147 outputs = [
148 { Arg.name = "diagnostics";
149 ty = Type.(Basic String);
150 description = "A string containing loggable human-readable diagnostics information";
151 }
152 ];
66cc2d4 @djs55 smapiv2: move "query" into the module "Query" for consistency with xenop...
authored
153 }
154 ]
155 };
156
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
157 {
158 Interface.name = "VDI";
159 description = "Operations which operate on Virtual Disk Images";
f1add48 @djs55 Start adding type declarations
authored
160 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
161 methods = [
162 {
163 Method.name = "create";
164 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.";
165 inputs = [
166 sr;
167 vdi_info';
168 params;
169 ];
170 outputs = [
171 { Arg.name = "new_vdi";
172 ty = vdi_info;
173 description = "The created Virtual Disk Image";
174 }
175 ];
176 }; {
177 Method.name = "snapshot";
b013794 @djs55 [smapiv2] update following interface change in xen-api df6728b316db4e00c...
authored
178 description = "[snapshot task sr vdi_info params] creates a new VDI which is a snapshot of [vdi_info.vdi] in [sr]";
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
179 inputs = [
180 sr;
181 vdi_info';
182 params;
183 ];
184 outputs = [
185 { Arg.name = "new_vdi";
186 ty = vdi_info;
b013794 @djs55 [smapiv2] update following interface change in xen-api df6728b316db4e00c...
authored
187 description = "[snapshot task sr vdi_info params] creates a new VDI which is a snapshot of [vdi_info.vdi] in [sr]";
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
188 }
189 ];
190 }; {
191 Method.name = "clone";
b013794 @djs55 [smapiv2] update following interface change in xen-api df6728b316db4e00c...
authored
192 description = "[clone task sr vdi_info params] creates a new VDI which is a clone of [vdi_info.vdi] in [sr]";
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
193 inputs = [
194 sr;
780a37c @djs55 smapiv2: declare VDI.snapshot
authored
195 vdi_info';
196 params;
197 ];
198 outputs = [
199 { Arg.name = "new_vdi";
200 ty = vdi_info;
b013794 @djs55 [smapiv2] update following interface change in xen-api df6728b316db4e00c...
authored
201 description = "[clone task sr vdi_info params] creates a new VDI which is a clone of [vdi_info.vdi] in [sr]";
780a37c @djs55 smapiv2: declare VDI.snapshot
authored
202 }
203 ];
204 }; {
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
205 Method.name = "destroy";
206 description = "[destroy task sr vdi] removes [vdi] from [sr]";
207 inputs = [
208 sr;
209 vdi;
210 ];
211 outputs = [
212 ];
213 }; {
af6f2f7 @djs55 smapiv2: add VDI.stat
authored
214 Method.name = "stat";
215 description = "[stat task sr vdi] returns metadata associated with VDI [vdi] in SR [sr].";
216 inputs = [
217 sr;
218 vdi;
219 ];
220 outputs = [
221 { Arg.name = "vdi_info";
222 ty = vdi_info;
223 description = "VDI metadata";
224 }
225 ];
226 }; {
e4cb5eb @djs55 smapiv2: declare VDI.set_persistent
authored
227 Method.name = "set_persistent";
228 description = "[set_persistent task sr vdi persistent] configures whether a VDI's contents should be persisted across epochs";
229 inputs = [
230 sr;
231 vdi;
232 { Arg.name = "persistent";
233 ty = Type.(Basic Boolean);
234 description = "New value of the VDI persistent field";
235 }
236 ];
237 outputs = [
238 ];
239 }; {
826505e @djs55 fs: add support for non-persistent disks
authored
240 Method.name = "epoch_begin";
241 description = "[epoch_begin task sr vdi] signals that VDI is about to be connected to a fresh (started, rebooted) VM.";
242 inputs = [
243 sr;
244 vdi;
245 ];
246 outputs = [
247 ];
248 }; {
249 Method.name = "epoch_end";
250 description = "[epoch_end task sr vdi] signals that VDI is about to be disconnected from a shutting-down/rebooting VM.";
251 inputs = [
252 sr;
253 vdi;
254 ];
255 outputs = [
256 ];
257 }; {
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
258 Method.name = "attach";
259 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";
260 inputs = [
261 { Arg.name = "dp";
262 ty = Type.(Basic String);
263 description = "DataPath to attach this VDI for";
264 };
265 sr;
266 vdi;
267 { Arg.name = "read_write";
268 ty = Type.(Basic Boolean);
269 description = "If true then the DataPath will be used read/write, false otherwise";
270 }
271 ];
272 outputs = [
ed0f6b3 @djs55 smapi: VDI.attach returns params and a xenstore_data now
authored
273 { Arg.name = "device";
274 ty = Type.(Struct(("params", Basic String, "blkback params key"), [
275 "xenstore_data", Dict(String, Basic String), "additional backend configuration for xenstore-data/"
276 ]));
277 description = "backend device configuration";
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
278 }
279 ];
280 }; {
281 Method.name = "activate";
282 description = "[activate task dp sr vdi] signals the desire to immediately use [vdi]. This client must have called [attach] on the [vdi] first.";
283 inputs = [
284 { Arg.name = "dp";
285 ty = Type.(Basic String);
286 description = "DataPath to attach this VDI for";
287 };
288 sr;
289 vdi;
290 ];
291 outputs = [
292 ];
293 }; {
294 Method.name = "deactivate";
295 description = "[deactivate task dp sr vdi] signals that this client has stopped reading (and writing) [vdi].";
296 inputs = [
297 { Arg.name = "dp";
298 ty = Type.(Basic String);
299 description = "DataPath to deactivate";
300 };
301 sr;
302 vdi;
303 ];
304 outputs = [
305 ];
306 }; {
307 Method.name = "detach";
308 description = "[detach task dp sr vdi] signals that this client no-longer needs the [params] to be valid.";
309 inputs = [
310 { Arg.name = "dp";
311 ty = Type.(Basic String);
312 description = "DataPath to detach";
313 };
314 sr;
315 vdi;
316 ];
317 outputs = [
318 ];
319 }; {
320 Method.name = "copy";
321 description = "[copy task sr vdi url sr2] copies the data from [vdi] into a remote system [url]'s [sr2]";
322 inputs = [
323 sr;
324 vdi;
325 { Arg.name = "url";
326 ty = Type.(Basic String);
327 description = "URL which identifies a remote system";
328 };
329 { sr with Arg.name = "dest" };
330 ];
331 outputs = [
332 { vdi with Arg.name = "new_vdi" }
333 ];
334 }; {
335 Method.name = "get_url";
336 description = "[get_url task sr vdi] returns a URL suitable for accessing disk data directly.";
337 inputs = [
338 sr;
339 vdi
340 ];
341 outputs = [
342 { Arg.name = "url";
343 ty = Type.(Basic String);
344 description = "URL which represents this VDI";
345 }
346 ];
347 }; {
348 Method.name = "get_by_name";
349 description = "[get_by_name task sr name] returns the vdi within [sr] with [name]";
350 inputs = [
351 sr;
352 { Arg.name = "name";
353 ty = Type.(Basic String);
354 description = "Name of the VDI to return";
355 };
356 ];
357 outputs = [
39aaf1c @djs55 smapiv2: VDI.get_by_name returns a VDI not a vdi_info
authored
358 vdi_info'
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
359 ];
360 }; {
361 Method.name = "set_content_id";
362 description = "[set_content_id task sr vdi content_id] tells the storage backend that a VDI has an updated [content_id]";
363 inputs = [
364 sr;
365 vdi;
366 { Arg.name = "content_id";
367 ty = Type.(Basic String);
368 description = "New value of the VDI content_id field";
369 }
370 ];
371 outputs = [
372 ];
373 }; {
374 Method.name = "compose";
375 description = "[compose task sr vdi1 vdi2] layers the updates from [vdi2] onto [vdi1], modifying [vdi2]";
376 inputs = [
377 sr;
378 { vdi with Arg.name = "vdi1" };
379 { vdi with Arg.name = "vdi2" };
380 ];
381 outputs = [
382 ];
297139e @djs55 smapiv2: add VDI.get_by_name
authored
383 }; {
384 Method.name = "get_by_name";
385 description = "[get_by_name sr name] resolves a name to a VDI";
386 inputs = [
387 sr;
388 { Arg.name = "name";
389 ty = Type.(Basic String);
390 description = "Name of VDI to resolve"
391 }
392 ];
393 outputs = [
710dcff @djs55 smapiv2: VDI.get_by_name returns a vdi_info
authored
394 vdi_info'
297139e @djs55 smapiv2: add VDI.get_by_name
authored
395 ]
2f969b6 @djs55 smapiv2: add VDI.similar_content
authored
396 }; {
397 Method.name = "similar_content";
398 description = "[similar_content sr vdi] returns a list, most similar first, of disks with recognizably similar content";
399 inputs = [
400 sr;
401 vdi;
402 ];
403 outputs = [
404 { Arg.name = "vdi_infos";
405 ty = Type.(Array (Name "vdi_info"));
406 description = "VDIs with recognizably similar content, most similar first"
407 }
408 ]
409 }
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
410 ]
411 }; {
412 Interface.name = "SR";
413 description = "Operations which act on Storage Repositories";
f1add48 @djs55 Start adding type declarations
authored
414 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
415 methods = [
959d313 @djs55 smapiv2: add SR.create
authored
416 {
9531032 @djs55 SMAPIv2: add SR.list
authored
417 Method.name = "list";
418 description = "[list dbg]: returns a list of attached SRs";
419 inputs = [];
420 outputs = [
421 {
422 Arg.name = "srs";
423 ty = Type.(Array (Basic String));
424 description = "The attached SRs"
425 }
426 ]
427 };
428 {
959d313 @djs55 smapiv2: add SR.create
authored
429 Method.name = "create";
430 description = "[create task sr device_config physical_size]: creates a fresh SR";
431 inputs = [
432 sr;
433 { Arg.name = "device_config";
434 ty = Type.(Dict(String, Basic String));
435 description = "Host-local SR configuration (e.g. address information)";
436 };
437 { Arg.name = "physical_size";
438 ty = Type.(Basic Int64);
439 description = "Requested maximum size of the SR (bytes)"
440 }
441 ];
442 outputs = []
443 };
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
444 {
445 Method.name = "attach";
446 description = "[attach task sr]: attaches the SR";
447 inputs = [
448 sr;
449 { Arg.name = "device_config";
450 ty = Type.(Dict(String, Basic String));
451 description = "Host-local SR configuration (e.g. address information)";
452 };
453 ];
454 outputs = [
455 ];
456 }; {
457 Method.name = "detach";
458 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.";
459 inputs = [
460 sr;
461 ];
462 outputs = [
463 ];
464 }; {
465 Method.name = "destroy";
466 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.";
467 inputs = [
468 sr;
469 ];
470 outputs = [
471 ];
472 }; {
473 Method.name = "reset";
474 description = "[reset task sr]: declares that the SR has been completely reset, e.g. by rebooting the VM hosting the SR backend.";
475 inputs = [
476 sr;
477 ];
478 outputs = [
479 ];
480 }; {
481 Method.name = "scan";
482 description = "[scan task sr] returns a list of VDIs contained within an attached SR";
483 inputs = [
484 sr;
485 ];
486 outputs = [
44d5a0d @djs55 Update the SMAPIv2, remove Mirror for now
authored
487 {
488 Arg.name = "vdis";
489 ty = Type.(Array (Name "vdi_info"));
490 description = "List of all the visible VDIs in the SR";
491 }
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
492 ];
493 }
494 ]
495 }
496 ]
497 }
Something went wrong with that request. Please try again.