Skip to content

Commit a102658

Browse files
committed
Merge pull request #14 from djs55/xapi-storage.0.2.1
Update to the new xapi-storage.0.2.1
2 parents e24abc8 + 66bee7c commit a102658

File tree

4 files changed

+69
-66
lines changed

4 files changed

+69
-66
lines changed

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
0.4.0 (28-Apr-2015)
2+
- Update to xapi-storage.0.2.1
3+
14
0.3.0 (24-Apr-2015)
25
- Update to message-switch.0.11.0
36

_oasis

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
OASISFormat: 0.2
22
Name: xapi-script-storage
3-
Version: 0.3
3+
Version: 0.4
44
Synopsis: Adapter which allows xapi to call storage scripts
55
Authors: David Scott
66
License: LGPL-2.1 with OCaml linking exception

main.ml

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,17 @@ end
128128

129129
let vdi_of_volume x =
130130
let open Storage_interface in {
131-
vdi = x.Storage.V.Types.key;
131+
vdi = x.Storage.Volume.Types.key;
132132
content_id = "";
133-
name_label = x.Storage.V.Types.name;
134-
name_description = x.Storage.V.Types.description;
133+
name_label = x.Storage.Volume.Types.name;
134+
name_description = x.Storage.Volume.Types.description;
135135
ty = "";
136136
metadata_of_pool = "";
137137
is_a_snapshot = false;
138138
snapshot_time = "19700101T00:00:00Z";
139139
snapshot_of = "";
140-
read_only = not x.Storage.V.Types.read_write;
141-
virtual_size = x.Storage.V.Types.virtual_size;
140+
read_only = not x.Storage.Volume.Types.read_write;
141+
virtual_size = x.Storage.Volume.Types.virtual_size;
142142
physical_utilisation = 0L;
143143
sm_config = [];
144144
persistent = true;
@@ -159,12 +159,12 @@ let script root_dir name kind script = match kind with
159159
| `Datapath datapath -> Filename.(concat (concat (concat (dirname root_dir) "datapath") datapath) script)
160160

161161
let stat root_dir name dbg sr vdi =
162-
let args = Storage.V.Types.Volume.Stat.In.make dbg sr vdi in
163-
let args = Storage.V.Types.Volume.Stat.In.rpc_of_t args in
162+
let args = Storage.Volume.Types.Volume.Stat.In.make dbg sr vdi in
163+
let args = Storage.Volume.Types.Volume.Stat.In.rpc_of_t args in
164164
let open Deferred.Result.Monad_infix in
165-
fork_exec_rpc root_dir (script root_dir name `Volume "Volume.stat") args Storage.V.Types.Volume.Stat.Out.t_of_rpc
165+
fork_exec_rpc root_dir (script root_dir name `Volume "Volume.stat") args Storage.Volume.Types.Volume.Stat.Out.t_of_rpc
166166
>>= fun response ->
167-
choose_datapath response.Storage.V.Types.uri
167+
choose_datapath response.Storage.Volume.Types.uri
168168

169169
(* Process a message *)
170170
let process root_dir name x =
@@ -174,34 +174,34 @@ let process root_dir name x =
174174
| { R.name = "Query.query"; R.params = [ args ] } ->
175175
let args = Args.Query.Query.request_of_rpc args in
176176
(* convert to new storage interface *)
177-
let args = Storage.P.Types.Plugin.Query.In.make args.Args.Query.Query.dbg in
178-
let args = Storage.P.Types.Plugin.Query.In.rpc_of_t args in
177+
let args = Storage.Plugin.Types.Plugin.Query.In.make args.Args.Query.Query.dbg in
178+
let args = Storage.Plugin.Types.Plugin.Query.In.rpc_of_t args in
179179
let open Deferred.Result.Monad_infix in
180-
fork_exec_rpc root_dir (script root_dir name `Volume "Plugin.Query") args Storage.P.Types.Plugin.Query.Out.t_of_rpc
180+
fork_exec_rpc root_dir (script root_dir name `Volume "Plugin.Query") args Storage.Plugin.Types.Plugin.Query.Out.t_of_rpc
181181
>>= fun response ->
182182
(* Convert between the xapi-storage interface and the SMAPI *)
183183
let features = List.map ~f:(function
184184
| "VDI_DESTROY" -> "VDI_DELETE"
185-
| x -> x) response.Storage.P.Types.features in
185+
| x -> x) response.Storage.Plugin.Types.features in
186186
let response = {
187-
driver = response.Storage.P.Types.plugin;
188-
name = response.Storage.P.Types.name;
189-
description = response.Storage.P.Types.description;
190-
vendor = response.Storage.P.Types.vendor;
191-
copyright = response.Storage.P.Types.copyright;
192-
version = response.Storage.P.Types.version;
193-
required_api_version = response.Storage.P.Types.required_api_version;
187+
driver = response.Storage.Plugin.Types.plugin;
188+
name = response.Storage.Plugin.Types.name;
189+
description = response.Storage.Plugin.Types.description;
190+
vendor = response.Storage.Plugin.Types.vendor;
191+
copyright = response.Storage.Plugin.Types.copyright;
192+
version = response.Storage.Plugin.Types.version;
193+
required_api_version = response.Storage.Plugin.Types.required_api_version;
194194
features;
195195
configuration =
196196
("uri", "URI of the storage medium") ::
197-
response.Storage.P.Types.configuration} in
197+
response.Storage.Plugin.Types.configuration} in
198198
Deferred.Result.return (R.success (Args.Query.Query.rpc_of_response response))
199199
| { R.name = "Query.diagnostics"; R.params = [ args ] } ->
200200
let args = Args.Query.Diagnostics.request_of_rpc args in
201-
let args = Storage.P.Types.Plugin.Diagnostics.In.make args.Args.Query.Diagnostics.dbg in
202-
let args = Storage.P.Types.Plugin.Diagnostics.In.rpc_of_t args in
201+
let args = Storage.Plugin.Types.Plugin.Diagnostics.In.make args.Args.Query.Diagnostics.dbg in
202+
let args = Storage.Plugin.Types.Plugin.Diagnostics.In.rpc_of_t args in
203203
let open Deferred.Result.Monad_infix in
204-
fork_exec_rpc root_dir (script root_dir name `Volume "Plugin.diagnostics") args Storage.P.Types.Plugin.Diagnostics.Out.t_of_rpc
204+
fork_exec_rpc root_dir (script root_dir name `Volume "Plugin.diagnostics") args Storage.Plugin.Types.Plugin.Diagnostics.Out.t_of_rpc
205205
>>= fun response ->
206206
Deferred.Result.return (R.success (Args.Query.Diagnostics.rpc_of_response response))
207207
| { R.name = "SR.attach"; R.params = [ args ] } ->
@@ -211,10 +211,10 @@ let process root_dir name x =
211211
| None ->
212212
Deferred.Result.return (R.failure (missing_uri ()))
213213
| Some (_, uri) ->
214-
let args' = Storage.V.Types.SR.Attach.In.make args.Args.SR.Attach.dbg uri in
215-
let args' = Storage.V.Types.SR.Attach.In.rpc_of_t args' in
214+
let args' = Storage.Volume.Types.SR.Attach.In.make args.Args.SR.Attach.dbg uri in
215+
let args' = Storage.Volume.Types.SR.Attach.In.rpc_of_t args' in
216216
let open Deferred.Result.Monad_infix in
217-
fork_exec_rpc root_dir (script root_dir name `Volume "SR.attach") args' Storage.V.Types.SR.Attach.Out.t_of_rpc
217+
fork_exec_rpc root_dir (script root_dir name `Volume "SR.attach") args' Storage.Volume.Types.SR.Attach.Out.t_of_rpc
218218
>>= fun response ->
219219
(* associate the 'sr' from the plugin with the SR reference passed in *)
220220
Attached_SRs.add args.Args.SR.Attach.sr response
@@ -230,11 +230,11 @@ let process root_dir name x =
230230
Deferred.Result.return (R.success (Args.SR.Detach.rpc_of_response ()))
231231
| Ok sr ->
232232
let open Deferred.Result.Monad_infix in
233-
let args' = Storage.V.Types.SR.Detach.In.make
233+
let args' = Storage.Volume.Types.SR.Detach.In.make
234234
args.Args.SR.Detach.dbg
235235
sr in
236-
let args' = Storage.V.Types.SR.Detach.In.rpc_of_t args' in
237-
fork_exec_rpc root_dir (script root_dir name `Volume "SR.detach") args' Storage.V.Types.SR.Detach.Out.t_of_rpc
236+
let args' = Storage.Volume.Types.SR.Detach.In.rpc_of_t args' in
237+
fork_exec_rpc root_dir (script root_dir name `Volume "SR.detach") args' Storage.Volume.Types.SR.Detach.Out.t_of_rpc
238238
>>= fun response ->
239239
Attached_SRs.remove args.Args.SR.Detach.sr
240240
>>= fun () ->
@@ -247,13 +247,13 @@ let process root_dir name x =
247247
| None ->
248248
Deferred.Result.return (R.failure (missing_uri ()))
249249
| Some (_, uri) ->
250-
let args = Storage.V.Types.SR.Create.In.make
250+
let args = Storage.Volume.Types.SR.Create.In.make
251251
args.Args.SR.Create.dbg
252252
uri
253253
device_config in
254-
let args = Storage.V.Types.SR.Create.In.rpc_of_t args in
254+
let args = Storage.Volume.Types.SR.Create.In.rpc_of_t args in
255255
let open Deferred.Result.Monad_infix in
256-
fork_exec_rpc root_dir (script root_dir name `Volume "SR.create") args Storage.V.Types.SR.Create.Out.t_of_rpc
256+
fork_exec_rpc root_dir (script root_dir name `Volume "SR.create") args Storage.Volume.Types.SR.Create.Out.t_of_rpc
257257
>>= fun response ->
258258
Deferred.Result.return (R.success (Args.SR.Create.rpc_of_response response))
259259
end
@@ -262,11 +262,11 @@ let process root_dir name x =
262262
let args = Args.SR.Scan.request_of_rpc args in
263263
Attached_SRs.find args.Args.SR.Scan.sr
264264
>>= fun sr ->
265-
let args = Storage.V.Types.SR.Ls.In.make
265+
let args = Storage.Volume.Types.SR.Ls.In.make
266266
args.Args.SR.Scan.dbg
267267
sr in
268-
let args = Storage.V.Types.SR.Ls.In.rpc_of_t args in
269-
fork_exec_rpc root_dir (script root_dir name `Volume "SR.ls") args Storage.V.Types.SR.Ls.Out.t_of_rpc
268+
let args = Storage.Volume.Types.SR.Ls.In.rpc_of_t args in
269+
fork_exec_rpc root_dir (script root_dir name `Volume "SR.ls") args Storage.Volume.Types.SR.Ls.Out.t_of_rpc
270270
>>= fun response ->
271271
let response = List.map ~f:vdi_of_volume response in
272272
Deferred.Result.return (R.success (Args.SR.Scan.rpc_of_response response))
@@ -276,14 +276,14 @@ let process root_dir name x =
276276
Attached_SRs.find args.Args.VDI.Create.sr
277277
>>= fun sr ->
278278
let vdi_info = args.Args.VDI.Create.vdi_info in
279-
let args = Storage.V.Types.Volume.Create.In.make
279+
let args = Storage.Volume.Types.Volume.Create.In.make
280280
args.Args.VDI.Create.dbg
281281
sr
282282
vdi_info.name_label
283283
vdi_info.name_description
284284
vdi_info.virtual_size in
285-
let args = Storage.V.Types.Volume.Create.In.rpc_of_t args in
286-
fork_exec_rpc root_dir (script root_dir name `Volume "Volume.create") args Storage.V.Types.Volume.Create.Out.t_of_rpc
285+
let args = Storage.Volume.Types.Volume.Create.In.rpc_of_t args in
286+
fork_exec_rpc root_dir (script root_dir name `Volume "Volume.create") args Storage.Volume.Types.Volume.Create.Out.t_of_rpc
287287
>>= fun response ->
288288
let response = vdi_of_volume response in
289289
Deferred.Result.return (R.success (Args.VDI.Create.rpc_of_response response))
@@ -292,12 +292,12 @@ let process root_dir name x =
292292
let args = Args.VDI.Destroy.request_of_rpc args in
293293
Attached_SRs.find args.Args.VDI.Destroy.sr
294294
>>= fun sr ->
295-
let args = Storage.V.Types.Volume.Destroy.In.make
295+
let args = Storage.Volume.Types.Volume.Destroy.In.make
296296
args.Args.VDI.Destroy.dbg
297297
sr
298298
args.Args.VDI.Destroy.vdi in
299-
let args = Storage.V.Types.Volume.Destroy.In.rpc_of_t args in
300-
fork_exec_rpc root_dir (script root_dir name `Volume "Volume.destroy") args Storage.V.Types.Volume.Destroy.Out.t_of_rpc
299+
let args = Storage.Volume.Types.Volume.Destroy.In.rpc_of_t args in
300+
fork_exec_rpc root_dir (script root_dir name `Volume "Volume.destroy") args Storage.Volume.Types.Volume.Destroy.Out.t_of_rpc
301301
>>= fun response ->
302302
Deferred.Result.return (R.success (Args.VDI.Destroy.rpc_of_response response))
303303
| { R.name = "VDI.snapshot"; R.params = [ args ] } ->
@@ -306,12 +306,12 @@ let process root_dir name x =
306306
Attached_SRs.find args.Args.VDI.Snapshot.sr
307307
>>= fun sr ->
308308
let vdi_info = args.Args.VDI.Snapshot.vdi_info in
309-
let args = Storage.V.Types.Volume.Snapshot.In.make
309+
let args = Storage.Volume.Types.Volume.Snapshot.In.make
310310
args.Args.VDI.Snapshot.dbg
311311
sr
312312
vdi_info.vdi in
313-
let args = Storage.V.Types.Volume.Snapshot.In.rpc_of_t args in
314-
fork_exec_rpc root_dir (script root_dir name `Volume "Volume.snapshot") args Storage.V.Types.Volume.Snapshot.Out.t_of_rpc
313+
let args = Storage.Volume.Types.Volume.Snapshot.In.rpc_of_t args in
314+
fork_exec_rpc root_dir (script root_dir name `Volume "Volume.snapshot") args Storage.Volume.Types.Volume.Snapshot.Out.t_of_rpc
315315
>>= fun response ->
316316
let response = vdi_of_volume response in
317317
Deferred.Result.return (R.success (Args.VDI.Snapshot.rpc_of_response response))
@@ -321,12 +321,12 @@ let process root_dir name x =
321321
Attached_SRs.find args.Args.VDI.Clone.sr
322322
>>= fun sr ->
323323
let vdi_info = args.Args.VDI.Clone.vdi_info in
324-
let args = Storage.V.Types.Volume.Clone.In.make
324+
let args = Storage.Volume.Types.Volume.Clone.In.make
325325
args.Args.VDI.Clone.dbg
326326
sr
327327
vdi_info.vdi in
328-
let args = Storage.V.Types.Volume.Clone.In.rpc_of_t args in
329-
fork_exec_rpc root_dir (script root_dir name `Volume "Volume.clone") args Storage.V.Types.Volume.Clone.Out.t_of_rpc
328+
let args = Storage.Volume.Types.Volume.Clone.In.rpc_of_t args in
329+
fork_exec_rpc root_dir (script root_dir name `Volume "Volume.clone") args Storage.Volume.Types.Volume.Clone.Out.t_of_rpc
330330
>>= fun response ->
331331
let response = vdi_of_volume response in
332332
Deferred.Result.return (R.success (Args.VDI.Clone.rpc_of_response response))
@@ -341,16 +341,16 @@ let process root_dir name x =
341341
sr
342342
args.Args.VDI.Attach.vdi
343343
>>= fun (datapath, uri, domain) ->
344-
let args' = Storage.D.Types.Datapath.Attach.In.make
344+
let args' = Storage.Datapath.Types.Datapath.Attach.In.make
345345
args.Args.VDI.Attach.dbg
346346
uri domain in
347-
let args' = Storage.D.Types.Datapath.Attach.In.rpc_of_t args' in
348-
fork_exec_rpc root_dir (script root_dir name (`Datapath datapath) "Datapath.attach") args' Storage.D.Types.Datapath.Attach.Out.t_of_rpc
347+
let args' = Storage.Datapath.Types.Datapath.Attach.In.rpc_of_t args' in
348+
fork_exec_rpc root_dir (script root_dir name (`Datapath datapath) "Datapath.attach") args' Storage.Datapath.Types.Datapath.Attach.Out.t_of_rpc
349349
>>= fun response ->
350-
let backend, params = match response.Storage.D.Types.implementation with
351-
| Storage.D.Types.Blkback p -> "vbd", p
352-
| Storage.D.Types.Qdisk p -> "qdisk", p
353-
| Storage.D.Types.Tapdisk3 p -> "vbd3", p in
350+
let backend, params = match response.Storage.Datapath.Types.implementation with
351+
| Storage.Datapath.Types.Blkback p -> "vbd", p
352+
| Storage.Datapath.Types.Qdisk p -> "qdisk", p
353+
| Storage.Datapath.Types.Tapdisk3 p -> "vbd3", p in
354354
let attach_info = {
355355
params;
356356
xenstore_data = [ "backend-kind", backend ];
@@ -369,11 +369,11 @@ let process root_dir name x =
369369
sr
370370
args.Args.VDI.Activate.vdi
371371
>>= fun (datapath, uri, domain) ->
372-
let args' = Storage.D.Types.Datapath.Activate.In.make
372+
let args' = Storage.Datapath.Types.Datapath.Activate.In.make
373373
args.Args.VDI.Activate.dbg
374374
uri domain in
375-
let args' = Storage.D.Types.Datapath.Activate.In.rpc_of_t args' in
376-
fork_exec_rpc root_dir (script root_dir name (`Datapath datapath) "Datapath.activate") args' Storage.D.Types.Datapath.Activate.Out.t_of_rpc
375+
let args' = Storage.Datapath.Types.Datapath.Activate.In.rpc_of_t args' in
376+
fork_exec_rpc root_dir (script root_dir name (`Datapath datapath) "Datapath.activate") args' Storage.Datapath.Types.Datapath.Activate.Out.t_of_rpc
377377
>>= fun response ->
378378
Deferred.Result.return (R.success (Args.VDI.Activate.rpc_of_response ()))
379379
| { R.name = "VDI.deactivate"; R.params = [ args ] } ->
@@ -387,11 +387,11 @@ let process root_dir name x =
387387
sr
388388
args.Args.VDI.Deactivate.vdi
389389
>>= fun (datapath, uri, domain) ->
390-
let args' = Storage.D.Types.Datapath.Deactivate.In.make
390+
let args' = Storage.Datapath.Types.Datapath.Deactivate.In.make
391391
args.Args.VDI.Deactivate.dbg
392392
uri domain in
393-
let args' = Storage.D.Types.Datapath.Deactivate.In.rpc_of_t args' in
394-
fork_exec_rpc root_dir (script root_dir name (`Datapath datapath) "Datapath.deactivate") args' Storage.D.Types.Datapath.Deactivate.Out.t_of_rpc
393+
let args' = Storage.Datapath.Types.Datapath.Deactivate.In.rpc_of_t args' in
394+
fork_exec_rpc root_dir (script root_dir name (`Datapath datapath) "Datapath.deactivate") args' Storage.Datapath.Types.Datapath.Deactivate.Out.t_of_rpc
395395
>>= fun response ->
396396
Deferred.Result.return (R.success (Args.VDI.Deactivate.rpc_of_response ()))
397397
| { R.name = "VDI.detach"; R.params = [ args ] } ->
@@ -405,11 +405,11 @@ let process root_dir name x =
405405
sr
406406
args.Args.VDI.Detach.vdi
407407
>>= fun (datapath, uri, domain) ->
408-
let args' = Storage.D.Types.Datapath.Detach.In.make
408+
let args' = Storage.Datapath.Types.Datapath.Detach.In.make
409409
args.Args.VDI.Detach.dbg
410410
uri domain in
411-
let args' = Storage.D.Types.Datapath.Detach.In.rpc_of_t args' in
412-
fork_exec_rpc root_dir (script root_dir name (`Datapath datapath) "Datapath.detach") args' Storage.D.Types.Datapath.Detach.Out.t_of_rpc
411+
let args' = Storage.Datapath.Types.Datapath.Detach.In.rpc_of_t args' in
412+
fork_exec_rpc root_dir (script root_dir name (`Datapath datapath) "Datapath.detach") args' Storage.Datapath.Types.Datapath.Detach.Out.t_of_rpc
413413
>>= fun response ->
414414
Deferred.Result.return (R.success (Args.VDI.Detach.rpc_of_response ()))
415415
| { R.name = "SR.stat"; R.params = [ args ] } ->

opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ depends: [
1313
"async" {= "111.25.00" }
1414
"async_inotify" {= "111.28.00" }
1515
"core"
16-
"message-switch"
16+
"message-switch" {>= "0.11.0" }
1717
]

0 commit comments

Comments
 (0)