Skip to content

Commit 26b87c6

Browse files
author
David Scott
committed
Volume.stat uses 'lvs'
Signed-off-by: David Scott <dave.scott@citrix.com>
1 parent 7d223a9 commit 26b87c6

File tree

1 file changed

+7
-9
lines changed
  • examples/volume/org.xen.xcp.storage.plainlvm

1 file changed

+7
-9
lines changed

examples/volume/org.xen.xcp.storage.plainlvm/Volume.stat

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ocamlscript
22
Ocaml.sources := ["common.ml"; "lvm.ml"];
3-
Ocaml.packs := ["xapi-storage"; "cmdliner"; "re.str"; "oUnit"];
3+
Ocaml.packs := ["xapi-storage"; "cmdliner"; "re.str"; "oUnit"; "uri"];
44
Ocaml.ocamlflags := ["-thread"]
55
--
66
(*
@@ -22,14 +22,12 @@ module Command = struct
2222
open Storage.V.Types
2323
include Volume.Stat
2424

25-
let command common { Volume.Stat.In.dbg; sr; key } = {
26-
key = key;
27-
name = "name";
28-
description = "description";
29-
read_write = true;
30-
uri = [ "nfs+vhd://" ^ key ];
31-
virtual_size = 1L;
32-
}
25+
let command common { Volume.Stat.In.dbg; sr; key } =
26+
let all = Lvm.lvs sr in
27+
try
28+
Lvm.volume_of_lv sr (List.find (fun x -> x.Lvm.name = key) all)
29+
with Not_found ->
30+
raise (Storage.V.Volume_does_not_exist key)
3331
end
3432

3533
module Test = struct

0 commit comments

Comments
 (0)