summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-09-16 15:22:36 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-09-16 15:22:36 +0000
commite7e246812e4426f71985770abb50356dfdd7ac0a (patch)
tree67725014e2b4605711df35b483b204bb299f0153
parenta82b2e32ac2f198f7176c33ac14383192c5ab37a (diff)
downloaddrakx-backup-do-not-use-e7e246812e4426f71985770abb50356dfdd7ac0a.tar
drakx-backup-do-not-use-e7e246812e4426f71985770abb50356dfdd7ac0a.tar.gz
drakx-backup-do-not-use-e7e246812e4426f71985770abb50356dfdd7ac0a.tar.bz2
drakx-backup-do-not-use-e7e246812e4426f71985770abb50356dfdd7ac0a.tar.xz
drakx-backup-do-not-use-e7e246812e4426f71985770abb50356dfdd7ac0a.zip
enhance lvm handling (mostly standalone)
-rw-r--r--perl-install/fsedit.pm15
-rw-r--r--perl-install/lvm.pm23
2 files changed, 26 insertions, 12 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 2ad84821b..d715262c9 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -47,6 +47,7 @@ my @suggestions_mntpoints = (
);
my @partitions_signatures = (
+ [ 0x8e, 0, "HM\1\0" ],
[ 0x83, 0x438, "\x53\xEF" ],
[ 0x183, 0x10034, "ReIsErFs" ],
[ 0x183, 0x10034, "ReIsEr2Fs" ],
@@ -89,6 +90,7 @@ sub raids {
my @parts = get_fstab(@$hds);
(grep { isRawRAID($_) } @parts) && detect_devices::raidAutoStart() or return [];
+ fs::get_major_minor(@parts);
my %devname2part = map { $_->{dev} => { %$_, device => $_->{dev} } } read_partitions();
my @raids;
@@ -157,15 +159,18 @@ sub hds {
}
push @hds, $hd;
}
+ #- detect raids before LVM allowing LVM on raid
+ my $raids = raids(\@hds);
+ my $all_hds = { %{ empty_all_hds() }, hds => \@hds, lvms => [], raids => $raids };
my @lvms;
- if (my @pvs = grep { isRawLVM($_) } map { partition_table::get_normal_parts($_) } @hds) {
+ if (my @pvs = grep { isRawLVM($_) } get_all_fstab($all_hds)) {
#- otherwise vgscan won't find them
devices::make($_->{device}) foreach @pvs;
require lvm;
foreach (@pvs) {
my $name = lvm::get_vg($_) or next;
- my ($lvm) = grep { $_->{LVMname} eq $name } (@hds, @lvms);
+ my ($lvm) = grep { $_->{LVMname} eq $name } @lvms;
if (!$lvm) {
$lvm = bless { disks => [], LVMname => $name }, 'lvm';
lvm::update_size($lvm);
@@ -176,11 +181,7 @@ sub hds {
push @{$lvm->{disks}}, $_;
}
}
-
- my $all_hds = { %{ empty_all_hds() }, hds => \@hds, lvms => \@lvms, raids => [] };
- fs::get_major_minor(get_all_fstab($all_hds));
-
- $all_hds->{raids} = raids(\@hds);
+ $all_hds->{lvms} = \@lvms;
$all_hds;
}
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index 72e1b4bb2..3ff0b4612 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -22,14 +22,27 @@ sub cylinder_size {
$hd->{PE_size};
}
+init();
-eval { modules::load('lvm-mod') };
-run_program::run('vgscan') if !-e '/etc/lvmtab';
-run_program::run('vgchange', '-a', 'y');
+sub init {
+ eval { modules::load('lvm-mod') };
+ run_program::run('vgscan') if !-e '/etc/lvmtab';
+ run_program::run('vgchange', '-a', 'y');
+}
+
+sub check {
+ my ($in) = @_;
+
+ my $f = '/sbin/pvcreate';
+ -e $f or $in->do_pkgs->install('lvm');
+ -e $f or $in->ask_warn('', "Mandatory package lvm is missing"), return;
+ init();
+ 1;
+}
sub get_vg {
my ($part) = @_;
- my $dev = devices::make($part->{device});
+ my $dev = expand_symlinks(devices::make($part->{device}));
(split(':', `pvdisplay -c $dev`))[1];
}
@@ -58,7 +71,7 @@ sub vg_add {
run_program::run('vgchange', '-a', 'n', $old_name);
run_program::run('vgremove', $old_name);
}
- my $dev = devices::make($part->{device});
+ my $dev = expand_symlinks(devices::make($part->{device}));
run_program::run_or_die('pvcreate', $dev);
my $prog = run_program::run('vgdisplay', $part->{lvm}) ? 'vgextend' : 'vgcreate';
run_program::run_or_die($prog, $part->{lvm}, $dev);