Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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