summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-02-04 14:28:32 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-02-04 14:28:32 +0000
commit40f21d013268820b7a91038abd87e6cf1b64ee01 (patch)
tree35475e6c5be45c04418be6073c8555f659de1207 /perl-install
parent8f98f854325dba960ff817827c92c226ca4abbba (diff)
downloaddrakx-40f21d013268820b7a91038abd87e6cf1b64ee01.tar
drakx-40f21d013268820b7a91038abd87e6cf1b64ee01.tar.gz
drakx-40f21d013268820b7a91038abd87e6cf1b64ee01.tar.bz2
drakx-40f21d013268820b7a91038abd87e6cf1b64ee01.tar.xz
drakx-40f21d013268820b7a91038abd87e6cf1b64ee01.zip
- replace PE_size with extent_size and get it (fix illegal division by 0)
- fix getting the output of pvs vgs lvs commands (chomp_ is not enough because of spaces at the end) - fix get_lvs() (and use lvs instead of vgdisplay)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/lvm.pm20
1 files changed, 11 insertions, 9 deletions
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index 2a7c1721f..19ee9105f 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -25,7 +25,7 @@ sub adjustEnd {}
sub write {}
sub cylinder_size {
my ($hd) = @_;
- $hd->{PE_size};
+ $hd->{extent_size};
}
init();
@@ -64,31 +64,33 @@ sub check {
sub get_vg {
my ($part) = @_;
my $dev = expand_symlinks(devices::make($part->{device}));
- chomp_(run_program::get_stdout('lvm2', 'pvs', '--noheadings', '-o', 'vg_name', $dev));
+ run_program::get_stdout('lvm2', 'pvs', '--noheadings', '-o', 'vg_name', $dev) =~ /(\S+)/ && $1;
}
sub update_size {
my ($lvm) = @_;
- $lvm->{totalsectors} = chomp_(run_program::get_stdout('lvm2', 'vgs', '--noheadings', '--nosuffix', '--units', 's', '-o', 'vg_size', $lvm->{VG_name}));
+ $lvm->{extent_size} = to_int(run_program::get_stdout('lvm2', 'vgs', '--noheadings', '--nosuffix', '--units', 's', '-o', 'vg_extent_size', $lvm->{VG_name}));
+ $lvm->{totalsectors} = to_int(run_program::get_stdout('lvm2', 'vgs', '--noheadings', '--nosuffix', '--units', 's', '-o', 'vg_size', $lvm->{VG_name}));
}
sub get_lv_size {
my ($lvm_device) = @_;
- chomp_(run_program::get_stdout('lvm2', 'lvs', '--noheadings', '--nosuffix', '--units', 's', '-o', 'lv_size', "/dev/$lvm_device"));
+ to_int(run_program::get_stdout('lvm2', 'lvs', '--noheadings', '--nosuffix', '--units', 's', '-o', 'lv_size', "/dev/$lvm_device"));
}
sub get_lvs {
my ($lvm) = @_;
- my @l = run_program::get_stdout('lvm2', 'vgdisplay', '-v', '-D', $lvm->{VG_name});
+ my @l = run_program::get_stdout('lvm2', 'lvs', '--noheadings', '--nosuffix', '--units', 's', '-o', 'lv_name', $lvm->{VG_name}) =~ /(\S+)/g;
$lvm->{primary}{normal} =
[
map {
- my $type = -e "/dev/$_" && fsedit::typeOfPart("/dev/$_");
+ my $device = "$lvm->{VG_name}/$_";
+ my $type = -e "/dev/$device" && fsedit::typeOfPart($device);
- { device => $_,
+ { device => $device,
type => $type || 0x83,
- size => get_lv_size($_) }
- } map { if_(m|^LV Name\s+/dev/(\S+)|, $1) } @l
+ size => get_lv_size($device) }
+ } @l
];
}