summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-12-18 15:12:01 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-12-18 15:12:01 +0000
commit739d2dead3c6afd511fa478df666c84739d6930b (patch)
treef63fc44c0a0d9c473a2b6fd3714b9d365d8f5c24
parentc033599e0f506ca7dff48aea19557b56c27048ea (diff)
downloaddrakx-backup-do-not-use-739d2dead3c6afd511fa478df666c84739d6930b.tar
drakx-backup-do-not-use-739d2dead3c6afd511fa478df666c84739d6930b.tar.gz
drakx-backup-do-not-use-739d2dead3c6afd511fa478df666c84739d6930b.tar.bz2
drakx-backup-do-not-use-739d2dead3c6afd511fa478df666c84739d6930b.tar.xz
drakx-backup-do-not-use-739d2dead3c6afd511fa478df666c84739d6930b.zip
add "new" to lvm.pm, and use it
-rw-r--r--perl-install/diskdrake/interactive.pm6
-rw-r--r--perl-install/fsedit.pm4
-rw-r--r--perl-install/lvm.pm6
3 files changed, 10 insertions, 6 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index f588061f2..e3055ca2a 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -770,12 +770,11 @@ sub Add2LVM {
my $lvm = $in->ask_from_listf_('', N("Choose an existing LVM to add to"),
sub { ref $_[0] ? $_[0]{VG_name} : $_[0] },
[ @$lvms, N_("new") ]) or return;
+ require lvm;
if (!ref $lvm) {
# create new lvm
my $name = $in->ask_from_entry('', N("LVM name?")) or return;
- $name =~ s/\W/_/g;
- $name = substr($name, 0, 63); # max length must be < NAME_LEN / 2 where NAME_LEN is 128
- $lvm = bless { disks => [], VG_name => $name }, 'lvm';
+ $lvm = new lvm($name);
push @$lvms, $lvm;
}
raid::make($all_hds->{raids}, $part) if isRAID($part);
@@ -783,7 +782,6 @@ sub Add2LVM {
push @{$lvm->{disks}}, $part;
delete $part->{mntpoint};
- require lvm;
lvm::check($in) if $::isStandalone;
lvm::vg_add($part);
lvm::update_size($lvm);
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index f50ab702d..bd5597d7e 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -149,7 +149,7 @@ sub lvms {
my $name = lvm::get_vg($_) or next;
my ($lvm) = grep { $_->{VG_name} eq $name } @lvms;
if (!$lvm) {
- $lvm = bless { disks => [], VG_name => $name }, 'lvm';
+ $lvm = new lvm($name);
lvm::update_size($lvm);
lvm::get_lvs($lvm);
push @lvms, $lvm;
@@ -629,7 +629,7 @@ sub auto_allocate_vgs {
require lvm;
foreach my $vg (@vgs) {
- my $lvm = bless { disks => [], VG_name => $vg->{VG_name} }, 'lvm';
+ my $lvm = new lvm($vg->{VG_name});
push @{$all_hds->{lvms}}, $lvm;
my @pvs_ = grep { !$vg->{parts} || $vg->{parts} =~ /\Q$_->{mntpoint}/ } @pvs;
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index 37965485f..4ae8e4ff2 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -13,6 +13,12 @@ use devices;
use run_program;
#- for partition_table_xxx emulation
+sub new {
+ my ($class, $name) = @_;
+ $name =~ s/\W/_/g;
+ $name = substr($name, 0, 63); # max length must be < NAME_LEN / 2 where NAME_LEN is 128
+ bless { disks => [], VG_name => $name }, $class;
+}
sub hasExtended { 0 }
sub adjustStart {}
sub adjustEnd {}