SI/lvm.pm
changeset 1 b9ddf49db5b8
child 3 1b975c58c5bf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SI/lvm.pm	Fri Jan 15 01:16:12 2010 +0100
@@ -0,0 +1,29 @@
+package SI::lvm;
+
+use strict;
+use warnings;
+use SI::tools;
+
+sub vg_info($\%) {
+	my ($file, $part) = @_;
+	foreach (map { (split /:/)[0] } map { /^\s*(.*)/; } `vgs --noheadings --separator :`) {
+		my $file = sprintf $file, $_;
+		run("vgcfgbackup -f $file >/dev/null");
+	}
+}
+
+sub lv_info($\%) {
+	my ($file, $part) = @_;
+
+	foreach my $p (keys %$part) {
+	`pvs -o +uuid --nameprefix --noheadings $p` =~ /\bLVM2_PV_UUID='(.*?)'/
+		or next;
+
+	$part->{$p}{type} = "pv";
+	$part->{$p}{uuid} = $1;
+
+	}
+
+}
+
+1;