diff options
author | Pascal Terjan <pterjan@mandriva.org> | 2009-09-18 10:20:02 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mandriva.org> | 2009-09-18 10:20:02 +0000 |
commit | efa17e3c6d9a5e8338be5726f8f5ab998fcde106 (patch) | |
tree | 73d7923b61e823dacfa1f652ed9f81f7f5f43774 /perl-install/diskdrake/interactive.pm | |
parent | d7b620ad2878c1822404a07115b51f2bc1cd3a26 (diff) | |
download | drakx-efa17e3c6d9a5e8338be5726f8f5ab998fcde106.tar drakx-efa17e3c6d9a5e8338be5726f8f5ab998fcde106.tar.gz drakx-efa17e3c6d9a5e8338be5726f8f5ab998fcde106.tar.bz2 drakx-efa17e3c6d9a5e8338be5726f8f5ab998fcde106.tar.xz drakx-efa17e3c6d9a5e8338be5726f8f5ab998fcde106.zip |
suggest a LVM name and refuse empty or existing one (#53769)
Diffstat (limited to 'perl-install/diskdrake/interactive.pm')
-rw-r--r-- | perl-install/diskdrake/interactive.pm | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 56ff98934..9aa427dad 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -883,6 +883,9 @@ sub Add2RAID { sub Add2LVM { my ($in, $hd, $part, $all_hds) = @_; my $lvms = $all_hds->{lvms}; + my @lvm_names = map { $_->{VG_name} } @$lvms; + use Data::Dumper; + print Dumper(@lvm_names); write_partitions($in, $_) or return foreach isRAID($part) ? @{$all_hds->{hds}} : $hd; my $lvm = $in->ask_from_listf_(N("Add to LVM"), N("Choose an existing LVM to add to"), @@ -891,8 +894,23 @@ sub Add2LVM { require lvm; if (!ref $lvm) { # create new lvm - # FIXME: when mdv2006 is out: remove the question mark from the dialog title - my $name = $in->ask_from_entry(N("LVM name?"), N("LVM name?")) or return; + my $n = 0; + while (member("vg$n", @lvm_names)) { + $n++; + } + + my $name = "vg$n"; + $in->ask_from_({ title => N("LVM name"), + messages => N("Enter a name for the new LVM volume group"), + focus_first => 1, + ok_disabled => sub { !$name }, + validate => sub { + member($name, @lvm_names) or return 1; + $in->ask_warn(N("Error"), N('"%s" already exists', $name)); + return 0; + } }, + [{label=>N("LVM name"),val=> \$name}]) or return; + $lvm = new lvm($name); push @$lvms, $lvm; } |