summaryrefslogtreecommitdiffstats
path: root/perl-install/lvm.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-01-20 19:12:12 +0000
committerThierry Vignaud <tv@mageia.org>2012-01-20 19:12:12 +0000
commit892cfc13886c4493895c6ba074da64950961a3ba (patch)
treec84eec00048b03e5ccb642f4b306ed70113ab399 /perl-install/lvm.pm
parentb29be28e78780c5627e7f1ee5179cd4c0fc99800 (diff)
downloaddrakx-892cfc13886c4493895c6ba074da64950961a3ba.tar
drakx-892cfc13886c4493895c6ba074da64950961a3ba.tar.gz
drakx-892cfc13886c4493895c6ba074da64950961a3ba.tar.bz2
drakx-892cfc13886c4493895c6ba074da64950961a3ba.tar.xz
drakx-892cfc13886c4493895c6ba074da64950961a3ba.zip
(suggest_lv_name_from_mnt_point, suggest_lv_name) suggest better LV
names based on the mount point rather than numbers
Diffstat (limited to 'perl-install/lvm.pm')
-rw-r--r--perl-install/lvm.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index a8837c91a..3a2667191 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -169,9 +169,19 @@ sub lv_delete {
@$list = grep { $_ != $lv } @$list;
}
+sub suggest_lv_name_from_mnt_point {
+ my ($lv) = @_;
+ my $str = $lv->{mntpoint};
+ $str = "root" if $str eq '/';
+ $str =~ s!^/!!;
+ $str =~ s!/!_!g;
+ $str;
+}
+
sub suggest_lv_name {
my ($lvm, $lv) = @_;
my $list = $lvm->{primary}{normal} ||= [];
+ $lv->{lv_name} ||= suggest_lv_name_from_mnt_point($lv);
$lv->{lv_name} ||= 1 + max(map { if_($_->{device} =~ /(\d+)$/, $1) } @$list);
}