From c9a35f48ca4ae3f503a2976b2e399eb814407f8f Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 4 Jun 2003 11:13:34 +0000 Subject: allow choosing lv name (thanks to Brian Murrell) --- perl-install/diskdrake/interactive.pm | 4 ++++ perl-install/lvm.pm | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 425ba1bb4..b279d96d2 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -81,6 +81,7 @@ struct part_loopback inherits part { struct part_lvm inherits part { # invalid: active, start, device_windobe, CHS + string lv_name } @@ -464,6 +465,9 @@ sub Create { if_($::expert && $hd->hasExtended, { label => N("Preference: "), val => \$primaryOrExtended, list => [ '', "Extended", "Primary", if_($::expert, "Extended_0x85") ] }, ), + if_($::expert && isLVM($hd), + { label => _("Logical volume name "), val => \$part->{lv_name}, list => [ qw(root swap usr home var), '' ], sort => 0, not_edit => 0 }, + ), ], changed => sub { if ($part->{start} + ($mb_size << 11) > $max) { if ($_[0] == 0) { diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm index 12c685e97..9b9ce8d58 100644 --- a/perl-install/lvm.pm +++ b/perl-install/lvm.pm @@ -128,9 +128,9 @@ sub lv_delete { sub lv_create { my ($lvm, $lv) = @_; my $list = $lvm->{primary}{normal} ||= []; - my $nb = 1 + max(map { basename($_->{device}) } @$list); - $lv->{device} = "$lvm->{VG_name}/$nb"; - run_or_die('lvcreate', '--size', int($lv->{size} / 2) . 'k', '-n', $nb, $lvm->{VG_name}); + $lv->{lv_name} ||= 1 + max(map { if_($_->{device} =~ /(\d+)$/, $1) } @$list); + $lv->{device} = "$lvm->{VG_name}/$lvm->{lv_name}"; + run_or_die('lvcreate', '--size', int($lv->{size} / 2) . 'k', '-n', $lv->{lv_name}, $lvm->{VG_name}); $lv->{size} = get_lv_size($lv->{device}); #- the created size is smaller than asked size $lv->{notFormatted} = 1; $lv->{isFormatted} = 0; -- cgit v1.2.1