Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 515 lines (512 sloc) 16.006 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 36b0a279c30962aa…
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 c…
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 xe…
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 xe…
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 xe…
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 xe…
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 xe…
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";
178 description = "[snapshot task sr vdi vdi_info params] creates a new VDI which is a snapshot of [vdi] in [sr]";
179 inputs = [
180 sr;
181 vdi;
182 vdi_info';
183 params;
184 ];
185 outputs = [
186 { Arg.name = "new_vdi";
187 ty = vdi_info;
188 description = "[snapshot task sr vdi vdi_info params] creates a new VDI which is a snapshot of [vdi] in [sr]";
189 }
190 ];
191 }; {
192 Method.name = "clone";
193 description = "[clone task sr vdi vdi_info params] creates a new VDI which is a clone of [vdi] in [sr]";
194 inputs = [
195 sr;
196 vdi;
197 vdi_info';
198 params;
199 ];
200 outputs = [
201 { Arg.name = "new_vdi";
202 ty = vdi_info;
203 description = "[clone task sr vdi vdi_info params] creates a new VDI which is a clone of [vdi] in [sr]";
204 }
205 ];
206 }; {
780a37c @djs55 smapiv2: declare VDI.snapshot
authored
207 Method.name = "snapshot";
208 description = "[snapshot task sr vdi vdi_info params] creates a new VDI which is a readonly snapshot of [vdi] in [sr]";
209 inputs = [
210 sr;
211 vdi;
212 vdi_info';
213 params;
214 ];
215 outputs = [
216 { Arg.name = "new_vdi";
217 ty = vdi_info;
218 description = "[clone task sr vdi vdi_info params] creates a new VDI which is a clone of [vdi] in [sr]";
219 }
220 ];
221 }; {
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
222 Method.name = "destroy";
223 description = "[destroy task sr vdi] removes [vdi] from [sr]";
224 inputs = [
225 sr;
226 vdi;
227 ];
228 outputs = [
229 ];
230 }; {
af6f2f7 @djs55 smapiv2: add VDI.stat
authored
231 Method.name = "stat";
232 description = "[stat task sr vdi] returns metadata associated with VDI [vdi] in SR [sr].";
233 inputs = [
234 sr;
235 vdi;
236 ];
237 outputs = [
238 { Arg.name = "vdi_info";
239 ty = vdi_info;
240 description = "VDI metadata";
241 }
242 ];
243 }; {
e4cb5eb @djs55 smapiv2: declare VDI.set_persistent
authored
244 Method.name = "set_persistent";
245 description = "[set_persistent task sr vdi persistent] configures whether a VDI's contents should be persisted across epochs";
246 inputs = [
247 sr;
248 vdi;
249 { Arg.name = "persistent";
250 ty = Type.(Basic Boolean);
251 description = "New value of the VDI persistent field";
252 }
253 ];
254 outputs = [
255 ];
256 }; {
826505e @djs55 fs: add support for non-persistent disks
authored
257 Method.name = "epoch_begin";
258 description = "[epoch_begin task sr vdi] signals that VDI is about to be connected to a fresh (started, rebooted) VM.";
259 inputs = [
260 sr;
261 vdi;
262 ];
263 outputs = [
264 ];
265 }; {
266 Method.name = "epoch_end";
267 description = "[epoch_end task sr vdi] signals that VDI is about to be disconnected from a shutting-down/rebooting VM.";
268 inputs = [
269 sr;
270 vdi;
271 ];
272 outputs = [
273 ];
274 }; {
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
275 Method.name = "attach";
276 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";
277 inputs = [
278 { Arg.name = "dp";
279 ty = Type.(Basic String);
280 description = "DataPath to attach this VDI for";
281 };
282 sr;
283 vdi;
284 { Arg.name = "read_write";
285 ty = Type.(Basic Boolean);
286 description = "If true then the DataPath will be used read/write, false otherwise";
287 }
288 ];
289 outputs = [
ed0f6b3 @djs55 smapi: VDI.attach returns params and a xenstore_data now
authored
290 { Arg.name = "device";
291 ty = Type.(Struct(("params", Basic String, "blkback params key"), [
292 "xenstore_data", Dict(String, Basic String), "additional backend configuration for xenstore-data/"
293 ]));
294 description = "backend device configuration";
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
295 }
296 ];
297 }; {
298 Method.name = "activate";
299 description = "[activate task dp sr vdi] signals the desire to immediately use [vdi]. This client must have called [attach] on the [vdi] first.";
300 inputs = [
301 { Arg.name = "dp";
302 ty = Type.(Basic String);
303 description = "DataPath to attach this VDI for";
304 };
305 sr;
306 vdi;
307 ];
308 outputs = [
309 ];
310 }; {
311 Method.name = "deactivate";
312 description = "[deactivate task dp sr vdi] signals that this client has stopped reading (and writing) [vdi].";
313 inputs = [
314 { Arg.name = "dp";
315 ty = Type.(Basic String);
316 description = "DataPath to deactivate";
317 };
318 sr;
319 vdi;
320 ];
321 outputs = [
322 ];
323 }; {
324 Method.name = "detach";
325 description = "[detach task dp sr vdi] signals that this client no-longer needs the [params] to be valid.";
326 inputs = [
327 { Arg.name = "dp";
328 ty = Type.(Basic String);
329 description = "DataPath to detach";
330 };
331 sr;
332 vdi;
333 ];
334 outputs = [
335 ];
336 }; {
337 Method.name = "copy";
338 description = "[copy task sr vdi url sr2] copies the data from [vdi] into a remote system [url]'s [sr2]";
339 inputs = [
340 sr;
341 vdi;
342 { Arg.name = "url";
343 ty = Type.(Basic String);
344 description = "URL which identifies a remote system";
345 };
346 { sr with Arg.name = "dest" };
347 ];
348 outputs = [
349 { vdi with Arg.name = "new_vdi" }
350 ];
351 }; {
352 Method.name = "get_url";
353 description = "[get_url task sr vdi] returns a URL suitable for accessing disk data directly.";
354 inputs = [
355 sr;
356 vdi
357 ];
358 outputs = [
359 { Arg.name = "url";
360 ty = Type.(Basic String);
361 description = "URL which represents this VDI";
362 }
363 ];
364 }; {
365 Method.name = "get_by_name";
366 description = "[get_by_name task sr name] returns the vdi within [sr] with [name]";
367 inputs = [
368 sr;
369 { Arg.name = "name";
370 ty = Type.(Basic String);
371 description = "Name of the VDI to return";
372 };
373 ];
374 outputs = [
39aaf1c @djs55 smapiv2: VDI.get_by_name returns a VDI not a vdi_info
authored
375 vdi_info'
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
376 ];
377 }; {
378 Method.name = "set_content_id";
379 description = "[set_content_id task sr vdi content_id] tells the storage backend that a VDI has an updated [content_id]";
380 inputs = [
381 sr;
382 vdi;
383 { Arg.name = "content_id";
384 ty = Type.(Basic String);
385 description = "New value of the VDI content_id field";
386 }
387 ];
388 outputs = [
389 ];
390 }; {
391 Method.name = "compose";
392 description = "[compose task sr vdi1 vdi2] layers the updates from [vdi2] onto [vdi1], modifying [vdi2]";
393 inputs = [
394 sr;
395 { vdi with Arg.name = "vdi1" };
396 { vdi with Arg.name = "vdi2" };
397 ];
398 outputs = [
399 ];
297139e @djs55 smapiv2: add VDI.get_by_name
authored
400 }; {
401 Method.name = "get_by_name";
402 description = "[get_by_name sr name] resolves a name to a VDI";
403 inputs = [
404 sr;
405 { Arg.name = "name";
406 ty = Type.(Basic String);
407 description = "Name of VDI to resolve"
408 }
409 ];
410 outputs = [
710dcff @djs55 smapiv2: VDI.get_by_name returns a vdi_info
authored
411 vdi_info'
297139e @djs55 smapiv2: add VDI.get_by_name
authored
412 ]
2f969b6 @djs55 smapiv2: add VDI.similar_content
authored
413 }; {
414 Method.name = "similar_content";
415 description = "[similar_content sr vdi] returns a list, most similar first, of disks with recognizably similar content";
416 inputs = [
417 sr;
418 vdi;
419 ];
420 outputs = [
421 { Arg.name = "vdi_infos";
422 ty = Type.(Array (Name "vdi_info"));
423 description = "VDIs with recognizably similar content, most similar first"
424 }
425 ]
426 }
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
427 ]
428 }; {
429 Interface.name = "SR";
430 description = "Operations which act on Storage Repositories";
f1add48 @djs55 Start adding type declarations
authored
431 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
432 methods = [
959d313 @djs55 smapiv2: add SR.create
authored
433 {
9531032 @djs55 SMAPIv2: add SR.list
authored
434 Method.name = "list";
435 description = "[list dbg]: returns a list of attached SRs";
436 inputs = [];
437 outputs = [
438 {
439 Arg.name = "srs";
440 ty = Type.(Array (Basic String));
441 description = "The attached SRs"
442 }
443 ]
444 };
445 {
959d313 @djs55 smapiv2: add SR.create
authored
446 Method.name = "create";
447 description = "[create task sr device_config physical_size]: creates a fresh SR";
448 inputs = [
449 sr;
450 { Arg.name = "device_config";
451 ty = Type.(Dict(String, Basic String));
452 description = "Host-local SR configuration (e.g. address information)";
453 };
454 { Arg.name = "physical_size";
455 ty = Type.(Basic Int64);
456 description = "Requested maximum size of the SR (bytes)"
457 }
458 ];
459 outputs = []
460 };
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
461 {
462 Method.name = "attach";
463 description = "[attach task sr]: attaches the SR";
464 inputs = [
465 sr;
466 { Arg.name = "device_config";
467 ty = Type.(Dict(String, Basic String));
468 description = "Host-local SR configuration (e.g. address information)";
469 };
470 ];
471 outputs = [
472 ];
473 }; {
474 Method.name = "detach";
475 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.";
476 inputs = [
477 sr;
478 ];
479 outputs = [
480 ];
481 }; {
482 Method.name = "destroy";
483 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.";
484 inputs = [
485 sr;
486 ];
487 outputs = [
488 ];
489 }; {
490 Method.name = "reset";
491 description = "[reset task sr]: declares that the SR has been completely reset, e.g. by rebooting the VM hosting the SR backend.";
492 inputs = [
493 sr;
494 ];
495 outputs = [
496 ];
497 }; {
498 Method.name = "scan";
499 description = "[scan task sr] returns a list of VDIs contained within an attached SR";
500 inputs = [
501 sr;
502 ];
503 outputs = [
44d5a0d @djs55 Update the SMAPIv2, remove Mirror for now
authored
504 {
505 Arg.name = "vdis";
506 ty = Type.(Array (Name "vdi_info"));
507 description = "List of all the visible VDIs in the SR";
508 }
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
509 ];
510 }
511 ]
512 }
513 ]
514 }
Something went wrong with that request. Please try again.