git.annexia.org
/
virt-top.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
40c683e
)
LVM2 PV detection.
author
Richard W.M. Jones
<rjones@redhat.com>
Tue, 15 Apr 2008 10:44:54 +0000
(11:44 +0100)
committer
Richard W.M. Jones
<rjones@redhat.com>
Tue, 15 Apr 2008 10:44:54 +0000
(11:44 +0100)
virt-df/virt_df_lvm2.ml
patch
|
blob
|
history
diff --git
a/virt-df/virt_df_lvm2.ml
b/virt-df/virt_df_lvm2.ml
index
4247dc3
..
9355597
100644
(file)
--- a/
virt-df/virt_df_lvm2.ml
+++ b/
virt-df/virt_df_lvm2.ml
@@
-29,6
+29,7
@@
let sector_size64 = 512L
let pv_label_offset = sector_size64
let pv_label_offset = sector_size64
+(* Probe to see if it's an LVM2 PV. Look for the "LABELONE" label. *)
let rec probe_pv dev =
try ignore (read_pv_label dev); true
with _ -> false
let rec probe_pv dev =
try ignore (read_pv_label dev); true
with _ -> false
@@
-37,6
+38,8
@@
and read_pv_label dev =
(* Load the second sector. *)
let bits = dev#read_bitstring pv_label_offset sector_size in
(* Load the second sector. *)
let bits = dev#read_bitstring pv_label_offset sector_size in
+ Bitmatch.hexdump_bitstring stdout bits;
+
bitmatch bits with
| labelone : 8*8 : bitstring; (* "LABELONE" *)
padding : 16*8 : bitstring;
bitmatch bits with
| labelone : 8*8 : bitstring; (* "LABELONE" *)
padding : 16*8 : bitstring;
@@
-49,6
+52,11
@@
and read_pv_label dev =
invalid_arg (sprintf "read_pv_label: %s: not an LVM2 physical volume"
dev#name)
invalid_arg (sprintf "read_pv_label: %s: not an LVM2 physical volume"
dev#name)
+(* We are passed a list of devices which we previously identified
+ * as PVs belonging to us. From these produce a list of all LVs
+ * (as devices) and return them. Note that we don't try to detect
+ * what is on these LVs - that will be done in the main code.
+ *)
let list_lvs devs = []
(* Register with main code. *)
let list_lvs devs = []
(* Register with main code. *)