Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 369 lines (366 sloc) 10.845 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";
33 ty = vdi_info;
34 description = "The Virtual Disk Image properties";
35 } in
36 let params = {
37 Arg.name = "params";
38 ty = Type.(Dict(String, Basic String));
39 description = "Additional key/value pairs";
40 } in
41 {
42 Interfaces.name = "SMAPIv2";
43 description = "The Storage Manager API";
f1add48 @djs55 Start adding type declarations
authored
44 type_decls = [ { TyDecl.name = "vdi_info";
45 description = "All per-VDI properties";
46 ty = vdi_info
47 } ];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
48 interfaces =
49 [
50 {
51 Interface.name = "VDI";
52 description = "Operations which operate on Virtual Disk Images";
f1add48 @djs55 Start adding type declarations
authored
53 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
54 methods = [
55 {
56 Method.name = "create";
57 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.";
58 inputs = [
59 sr;
60 vdi_info';
61 params;
62 ];
63 outputs = [
64 { Arg.name = "new_vdi";
65 ty = vdi_info;
66 description = "The created Virtual Disk Image";
67 }
68 ];
69 }; {
70 Method.name = "snapshot";
71 description = "[snapshot task sr vdi vdi_info params] creates a new VDI which is a snapshot of [vdi] in [sr]";
72 inputs = [
73 sr;
74 vdi;
75 vdi_info';
76 params;
77 ];
78 outputs = [
79 { Arg.name = "new_vdi";
80 ty = vdi_info;
81 description = "[snapshot task sr vdi vdi_info params] creates a new VDI which is a snapshot of [vdi] in [sr]";
82 }
83 ];
84 }; {
85 Method.name = "clone";
86 description = "[clone task sr vdi vdi_info params] creates a new VDI which is a clone of [vdi] in [sr]";
87 inputs = [
88 sr;
89 vdi;
90 vdi_info';
91 params;
92 ];
93 outputs = [
94 { Arg.name = "new_vdi";
95 ty = vdi_info;
96 description = "[clone task sr vdi vdi_info params] creates a new VDI which is a clone of [vdi] in [sr]";
97 }
98 ];
99 }; {
100 Method.name = "destroy";
101 description = "[destroy task sr vdi] removes [vdi] from [sr]";
102 inputs = [
103 sr;
104 vdi;
105 ];
106 outputs = [
107 ];
108 }; {
109 Method.name = "attach";
110 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";
111 inputs = [
112 { Arg.name = "dp";
113 ty = Type.(Basic String);
114 description = "DataPath to attach this VDI for";
115 };
116 sr;
117 vdi;
118 { Arg.name = "read_write";
119 ty = Type.(Basic Boolean);
120 description = "If true then the DataPath will be used read/write, false otherwise";
121 }
122 ];
123 outputs = [
124 { Arg.name = "params";
125 ty = Type.(Basic String);
126 description = "xenstore backend params key";
127 }
128 ];
129 }; {
130 Method.name = "activate";
131 description = "[activate task dp sr vdi] signals the desire to immediately use [vdi]. This client must have called [attach] on the [vdi] first.";
132 inputs = [
133 { Arg.name = "dp";
134 ty = Type.(Basic String);
135 description = "DataPath to attach this VDI for";
136 };
137 sr;
138 vdi;
139 ];
140 outputs = [
141 ];
142 }; {
143 Method.name = "deactivate";
144 description = "[deactivate task dp sr vdi] signals that this client has stopped reading (and writing) [vdi].";
145 inputs = [
146 { Arg.name = "dp";
147 ty = Type.(Basic String);
148 description = "DataPath to deactivate";
149 };
150 sr;
151 vdi;
152 ];
153 outputs = [
154 ];
155 }; {
156 Method.name = "detach";
157 description = "[detach task dp sr vdi] signals that this client no-longer needs the [params] to be valid.";
158 inputs = [
159 { Arg.name = "dp";
160 ty = Type.(Basic String);
161 description = "DataPath to detach";
162 };
163 sr;
164 vdi;
165 ];
166 outputs = [
167 ];
168 }; {
169 Method.name = "copy";
170 description = "[copy task sr vdi url sr2] copies the data from [vdi] into a remote system [url]'s [sr2]";
171 inputs = [
172 sr;
173 vdi;
174 { Arg.name = "url";
175 ty = Type.(Basic String);
176 description = "URL which identifies a remote system";
177 };
178 { sr with Arg.name = "dest" };
179 ];
180 outputs = [
181 { vdi with Arg.name = "new_vdi" }
182 ];
183 }; {
184 Method.name = "get_url";
185 description = "[get_url task sr vdi] returns a URL suitable for accessing disk data directly.";
186 inputs = [
187 sr;
188 vdi
189 ];
190 outputs = [
191 { Arg.name = "url";
192 ty = Type.(Basic String);
193 description = "URL which represents this VDI";
194 }
195 ];
196 }; {
197 Method.name = "get_by_name";
198 description = "[get_by_name task sr name] returns the vdi within [sr] with [name]";
199 inputs = [
200 sr;
201 { Arg.name = "name";
202 ty = Type.(Basic String);
203 description = "Name of the VDI to return";
204 };
205 ];
206 outputs = [
207 vdi
208 ];
209 }; {
210 Method.name = "set_content_id";
211 description = "[set_content_id task sr vdi content_id] tells the storage backend that a VDI has an updated [content_id]";
212 inputs = [
213 sr;
214 vdi;
215 { Arg.name = "content_id";
216 ty = Type.(Basic String);
217 description = "New value of the VDI content_id field";
218 }
219 ];
220 outputs = [
221 ];
222 }; {
223 Method.name = "compose";
224 description = "[compose task sr vdi1 vdi2] layers the updates from [vdi2] onto [vdi1], modifying [vdi2]";
225 inputs = [
226 sr;
227 { vdi with Arg.name = "vdi1" };
228 { vdi with Arg.name = "vdi2" };
229 ];
230 outputs = [
231 ];
232 }
233
234 ]
235 }; {
236 Interface.name = "SR";
237 description = "Operations which act on Storage Repositories";
f1add48 @djs55 Start adding type declarations
authored
238 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
239 methods = [
240 {
241 Method.name = "attach";
242 description = "[attach task sr]: attaches the SR";
243 inputs = [
244 sr;
245 { Arg.name = "device_config";
246 ty = Type.(Dict(String, Basic String));
247 description = "Host-local SR configuration (e.g. address information)";
248 };
249 ];
250 outputs = [
251 ];
252 }; {
253 Method.name = "detach";
254 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.";
255 inputs = [
256 sr;
257 ];
258 outputs = [
259 ];
260 }; {
261 Method.name = "destroy";
262 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.";
263 inputs = [
264 sr;
265 ];
266 outputs = [
267 ];
268 }; {
269 Method.name = "reset";
270 description = "[reset task sr]: declares that the SR has been completely reset, e.g. by rebooting the VM hosting the SR backend.";
271 inputs = [
272 sr;
273 ];
274 outputs = [
275 ];
276 }; {
277 Method.name = "scan";
278 description = "[scan task sr] returns a list of VDIs contained within an attached SR";
279 inputs = [
280 sr;
281 ];
282 outputs = [
283 (* XXX: vdi_info list *)
284 ];
285 }
286 ]
287 }; {
288 Interface.name = "DP";
289 description = "Operations which act on DataPaths";
f1add48 @djs55 Start adding type declarations
authored
290 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
291 methods = [
292 {
293 Method.name = "create";
294 description = "[create task id]: creates and returns a dp";
295 inputs = [
296 { Arg.name = "id";
297 ty = Type.(Basic String);
298 description = "Human-readable DataPath name, for logging and diagnostics";
299 }
300 ];
301 outputs = [
302 { Arg.name = "id";
303 ty = Type.(Basic String);
304 description = "Abstract DataPath identifier";
305 }
306 ];
307 }; {
308 Method.name = "destroy";
309 description = "[destroy task id]: frees any resources associated with [id] and destroys it. This will typically do any needed VDI.detach, VDI.deactivate cleanup.";
310 inputs = [
311 { Arg.name = "id";
312 ty = Type.(Basic String);
313 description = "Abstract DataPath identifier";
314 }; {
315 Arg.name = "allow_leak";
316 ty = Type.(Basic Boolean);
317 description = "If true then a failure will be logged but the call will not fail";
318 }
319 ];
320 outputs = [
321 ];
322 }; {
323 Method.name = "diagnostics";
324 description = "[diagnostics ()]: returns a printable set of diagnostic information, typically including lists of all registered datapaths and their allocated resources.";
325 inputs = [
326 ];
327 outputs = [
328 { Arg.name = "diagnostics";
329 ty = Type.(Basic String);
330 description = "A string containing loggable human-readable diagnostics information";
331 }
332 ];
333 }
334 ]
335 }; {
336 Interface.name = "Mirror";
337 description = "Operations which act on disk mirrors.";
f1add48 @djs55 Start adding type declarations
authored
338 type_decls = [];
b4afb46 @djs55 Move the SMAPIv2 definition to its own file, making way for a xenops API
authored
339 methods = [
340 {
341 Method.name = "start";
342 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.";
343 inputs = [
344 sr;
345 vdi;
346 { Arg.name = "url";
347 ty = Type.(Basic String);
348 description = "The URL to mirror the VDI to";
349 };
350 { sr with Arg.name = "dest" }
351 ];
352 outputs = [
353 { vdi with Arg.name = "new_vdi" }
354 ];
355 }; {
356 Method.name = "stop";
357 description = "[stop task sr vdi] stops mirroring local [vdi]";
358 inputs = [
359 sr;
360 vdi;
361 ];
362 outputs = [
363 ];
364 }
365 ]
366 }
367 ]
368 }
Something went wrong with that request. Please try again.