File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
examples/volume/org.xen.xcp.storage.plainlvm Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ module Command = struct
3030 description = " " ;
3131 read_write = true ;
3232 uri = [" block://" ^ (Lvm. path_of sr lv.Lvm. name) ];
33- virtual_size = 0L ;
33+ virtual_size = lv. Lvm. size ;
3434 } ) (Lvm. lvs sr)
3535end
3636
@@ -47,7 +47,7 @@ module Test = struct
4747 finally
4848 (fun () ->
4949 match Lvm. lvs vg_name with
50- | [ { Lvm. name = " testvol" ; tags = [] } ] -> ()
50+ | [ { Lvm. name = " testvol" } ] -> ()
5151 | [ ] -> failwith " I created 'testvol' but it didnt show in 'lvs'"
5252 | _ -> failwith " I created 'testvol' but multiple volumes showed up in 'lvs'"
5353 ) (fun () ->
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ let lvremove vg_name lv_name =
5858
5959type lv = {
6060 name : string ;
61- tags : string list ;
61+ size : int64 ;
6262}
6363
6464let newline = Re_str. regexp_string " \n "
@@ -68,16 +68,17 @@ let comma = Re_str.regexp_string ","
6868let to_lines output = List. filter (fun x -> x <> " " ) (Re_str. split_delim newline output)
6969
7070let lvs vg_name =
71- Common. run " lvs" [ " -o" ; " lv_name,tags " ; " --noheadings" ; vg_name ]
71+ Common. run " lvs" [ " -o" ; " lv_name,lv_size " ; " --units " ; " b " ; " --noheadings" ; vg_name ]
7272 |> to_lines
7373 |> List. map
7474 (fun line ->
7575 match List. filter (fun x -> x <> " " ) (Re_str. split_delim whitespace line) with
76- | [ x; y ] -> { name = x; tags = Re_str. split_delim comma y }
77- | [ x ] -> { name = x; tags = [] }
76+ | [ x; y ] ->
77+ let size = Int64. of_string (String. sub y 0 (String. length y - 1 )) in
78+ { name = x; size }
7879 | _ ->
79- debug " Couldn't parse the LV name/ list of tags : [%s]" line;
80- failwith (Printf. sprintf " Couldn't parse the LV name/ list of tags : [%s]" line)
80+ debug " Couldn't parse the LV name/ size : [%s]" line;
81+ failwith (Printf. sprintf " Couldn't parse the LV name/ size : [%s]" line)
8182 )
8283
8384let device vg_name lv_name = Printf. sprintf " /dev/%s/%s" vg_name lv_name
You can’t perform that action at this time.
0 commit comments