Skip to content

Commit 7d223a9

Browse files
author
David Scott
committed
SR.ls uses a common 'volume_of_lv' function
Signed-off-by: David Scott <dave.scott@citrix.com>
1 parent 0817102 commit 7d223a9

File tree

2 files changed

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

2 files changed

+9
-9
lines changed

examples/volume/org.xen.xcp.storage.plainlvm/SR.ls

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,7 @@ module Command = struct
2323
include SR.Ls
2424

2525
let command common { SR.Ls.In.dbg; sr } =
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 = lv.Lvm.size;
34-
} ) (Lvm.lvs sr)
26+
List.map (Lvm.volume_of_lv sr) (Lvm.lvs sr)
3527
end
3628

3729
module Test = struct

examples/volume/org.xen.xcp.storage.plainlvm/lvm.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,11 @@ let path_of vg lv =
118118
let lv' = Re_str.split_delim dash lv in
119119
"/dev/mapper/" ^ vg ^ "-" ^ (String.concat "--" lv')
120120

121+
let volume_of_lv sr lv = {
122+
Storage.V.Types.key = lv.name;
123+
name = lv.name;
124+
description = "";
125+
read_write = true;
126+
uri = ["block://" ^ (path_of sr lv.name) ];
127+
virtual_size = lv.size;
128+
}

0 commit comments

Comments
 (0)