File tree Expand file tree Collapse file tree 1 file changed +36
-3
lines changed
examples/volume/org.xen.xcp.storage.plainlvm Expand file tree Collapse file tree 1 file changed +36
-3
lines changed Original file line number Diff line number Diff line change 11# ! / usr/ bin/ env ocamlscript
22Ocaml. sources := [" common.ml" ; " lvm.ml" ];
3- Ocaml. packs := [" xapi-storage" ; " cmdliner" ; " re.str" ; " oUnit" ];
3+ Ocaml. packs := [" xapi-storage" ; " cmdliner" ; " re.str" ; " oUnit" ; " uri " ];
44Ocaml. ocamlflags := [" -thread" ]
55--
66(*
@@ -23,13 +23,46 @@ module Command = struct
2323 include SR. Ls
2424
2525 let command common { SR.Ls.In. dbg; sr } =
26- []
26+ List. map
27+ (fun lv -> {
28+ key = lv.Lvm. name;
29+ name = lv.Lvm. name;
30+ description = " " ;
31+ read_write = true ;
32+ uri = [" block://" ^ (Lvm. path_of sr lv.Lvm. name) ];
33+ virtual_size = 0L ;
34+ } ) (Lvm. lvs sr)
2735end
2836
2937module Test = struct
3038 open OUnit
3139
32- let test common = ()
40+ let test_lvs () =
41+ let vol = Lvm. make_temp_volume () in
42+ let vg_name = " hello" in
43+ finally
44+ (fun () ->
45+ Lvm. vgcreate vg_name [ vol ];
46+ Lvm. lvcreate vg_name " testvol" 1L ;
47+ finally
48+ (fun () ->
49+ match Lvm. lvs vg_name with
50+ | [ { Lvm. name = " testvol" ; tags = [] } ] -> ()
51+ | [ ] -> failwith " I created 'testvol' but it didnt show in 'lvs'"
52+ | _ -> failwith " I created 'testvol' but multiple volumes showed up in 'lvs'"
53+ ) (fun () ->
54+ Lvm. lvremove vg_name " testvol"
55+ )
56+ ) (fun () ->
57+ Lvm. remove_temp_volume vol
58+ )
59+
60+ let test common =
61+ let suite = " create" > ::: [
62+ " lvs" > :: test_lvs;
63+ ] in
64+ ignore(run_test_tt ~verbose: common.Common. verbose suite)
65+
3366end
3467
3568module M = Make (Command )(Test )
You can’t perform that action at this time.
0 commit comments