SI/lvm.pm
changeset 1 b9ddf49db5b8
child 3 1b975c58c5bf
equal deleted inserted replaced
0:c0faaa882cf6 1:b9ddf49db5b8
       
     1 package SI::lvm;
       
     2 
       
     3 use strict;
       
     4 use warnings;
       
     5 use SI::tools;
       
     6 
       
     7 sub vg_info($\%) {
       
     8 	my ($file, $part) = @_;
       
     9 	foreach (map { (split /:/)[0] } map { /^\s*(.*)/; } `vgs --noheadings --separator :`) {
       
    10 		my $file = sprintf $file, $_;
       
    11 		run("vgcfgbackup -f $file >/dev/null");
       
    12 	}
       
    13 }
       
    14 
       
    15 sub lv_info($\%) {
       
    16 	my ($file, $part) = @_;
       
    17 
       
    18 	foreach my $p (keys %$part) {
       
    19 	`pvs -o +uuid --nameprefix --noheadings $p` =~ /\bLVM2_PV_UUID='(.*?)'/
       
    20 		or next;
       
    21 
       
    22 	$part->{$p}{type} = "pv";
       
    23 	$part->{$p}{uuid} = $1;
       
    24 
       
    25 	}
       
    26 
       
    27 }
       
    28 
       
    29 1;