diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2008-04-15 11:44:54 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2008-04-15 11:44:54 +0100 |
commit | bb0788a39d9b8675db60a61ecd2baebfdfb5ca10 (patch) | |
tree | 9584b10ec2ee139d6fa4ef217f3bee603e08f6c3 /virt-df | |
parent | 40c683ea4c9d921a6fe23c2639125261b92da472 (diff) | |
download | virt-top-bb0788a39d9b8675db60a61ecd2baebfdfb5ca10.tar.gz virt-top-bb0788a39d9b8675db60a61ecd2baebfdfb5ca10.tar.xz virt-top-bb0788a39d9b8675db60a61ecd2baebfdfb5ca10.zip |
LVM2 PV detection.
Diffstat (limited to 'virt-df')
-rw-r--r-- | virt-df/virt_df_lvm2.ml | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/virt-df/virt_df_lvm2.ml b/virt-df/virt_df_lvm2.ml index 4247dc3..9355597 100644 --- 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 +(* 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 @@ -37,6 +38,8 @@ and read_pv_label dev = (* 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; @@ -49,6 +52,11 @@ and read_pv_label dev = 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. *) |