On some system (debian), logical volume already have /dev/$group in their name

So fix the logical volume name in this case
This commit is contained in:
Daniel Berteaud 2013-04-18 10:13:15 +02:00
parent 6137dbbab2
commit c9cc8235c4

View File

@ -13,7 +13,8 @@ if ($what eq "volumes"){
foreach my $group (get_volume_group_list()){
my %lvs = get_logical_volume_information($group);
foreach my $lv (keys %lvs){
push @{$json->{data}}, { "{#LVMVOL}" => "/dev/$group/$lv" };
$lv = ($lv =~ m!^/dev/$group!) ? $lv : "/dev/$group/$lv";
push @{$json->{data}}, { "{#LVMVOL}" => "$lv" };
}
}
}
@ -22,7 +23,8 @@ elsif ($what eq "snapshots"){
my %lvs = get_logical_volume_information($group);
foreach my $lv (keys %lvs){
if (defined $lvs{$lv}->{allocated_to_snapshot}){
push @{$json->{data}}, { "{#LVMSNAP}" => "/dev/$group/$lv" };
$lv = ($lv =~ m!^/dev/$group!) ? $lv : "/dev/$group/$lv";
push @{$json->{data}}, { "{#LVMSNAP}" => "$lv" };
}
}
}