summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-19 14:53:42 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-19 14:53:42 +0000
commited52e4f09e2822abb261b4c360979ce7c38fe348 (patch)
tree4ec495f140b2188152e2816b87ee91d7e53be69d
parenta9042d2def58b5262e307f227432c27c45ff1d68 (diff)
downloaddrakx-ed52e4f09e2822abb261b4c360979ce7c38fe348.tar
drakx-ed52e4f09e2822abb261b4c360979ce7c38fe348.tar.gz
drakx-ed52e4f09e2822abb261b4c360979ce7c38fe348.tar.bz2
drakx-ed52e4f09e2822abb261b4c360979ce7c38fe348.tar.xz
drakx-ed52e4f09e2822abb261b4c360979ce7c38fe348.zip
- create lvm::add_to_VG() out of diskdrake::interactive::Add2LVM()
- lvm::check() now takes a $do_pkgs - help pvcreate (it may fail if it finds previous metadata on the MBR)
-rw-r--r--perl-install/diskdrake/interactive.pm9
-rw-r--r--perl-install/lvm.pm16
2 files changed, 16 insertions, 9 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index a23dcbe0c..2c306efae 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -872,13 +872,8 @@ sub Add2LVM {
push @$lvms, $lvm;
}
raid::make($all_hds->{raids}, $part) if isRAID($part);
- $part->{lvm} = $lvm->{VG_name};
- push @{$lvm->{disks}}, $part;
- delete $part->{mntpoint};
-
- lvm::check($in) if $::isStandalone;
- lvm::vg_add($part);
- lvm::update_size($lvm);
+ lvm::check($in->do_pkgs) if $::isStandalone;
+ lvm::add_to_VG($lvm, $part);
}
sub Unmount {
my ($_in, $_hd, $part) = @_;
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index 2c51b2768..decdfb376 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -57,9 +57,9 @@ sub lvm_cmd_or_die {
}
sub check {
- my ($in) = @_;
+ my ($do_pkgs) = @_;
- $in->do_pkgs->ensure_binary_is_installed('lvm2', 'lvm2') or return;
+ $do_pkgs->ensure_binary_is_installed('lvm2', 'lvm2') or return;
init();
1;
}
@@ -125,6 +125,7 @@ sub get_lvs {
sub vg_add {
my ($part) = @_;
my $dev = expand_symlinks(devices::make($part->{device}));
+ output($dev, '\0' x 512); #- help pvcreate
lvm_cmd_or_die('pvcreate', '-y', '-ff', $dev);
my $prog = lvm_cmd('vgs', $part->{lvm}) ? 'vgextend' : 'vgcreate';
lvm_cmd_or_die($prog, $part->{lvm}, $dev);
@@ -192,4 +193,15 @@ sub lv_resize {
$lv->{size} = get_lv_size($lv->{device}); #- the resized partition may not be the exact asked size
}
+sub add_to_VG {
+ my ($part, $lvm) = @_;
+
+ $part->{lvm} = $lvm->{VG_name};
+ push @{$lvm->{disks}}, $part;
+ delete $part->{mntpoint};
+
+ lvm::vg_add($part);
+ lvm::update_size($lvm);
+}
+
1;