summaryrefslogtreecommitdiffstats
path: root/perl-install/lvm.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-02-16 20:34:00 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-02-16 20:34:00 +0000
commitab936ab47f2bdb575c75a550594ba30a7c261bde (patch)
treee33684fea190c732b9c953cca3c1159de5b5221f /perl-install/lvm.pm
parente8f22851721ae797d59e6f8814a5440a27bf34ed (diff)
downloaddrakx-ab936ab47f2bdb575c75a550594ba30a7c261bde.tar
drakx-ab936ab47f2bdb575c75a550594ba30a7c261bde.tar.gz
drakx-ab936ab47f2bdb575c75a550594ba30a7c261bde.tar.bz2
drakx-ab936ab47f2bdb575c75a550594ba30a7c261bde.tar.xz
drakx-ab936ab47f2bdb575c75a550594ba30a7c261bde.zip
- LVs "device" field were containing "/dev/vg/number" whereas it must be "vg/name"
- added lv_resize
Diffstat (limited to 'perl-install/lvm.pm')
-rw-r--r--perl-install/lvm.pm16
1 files changed, 11 insertions, 5 deletions
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index 74d831bf7..b82cb589c 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -57,11 +57,11 @@ sub get_lvs {
$lvm->{primary}{normal} =
[
map {
- my $type = -e $_ && fsedit::typeOfPart($_);
+ my $type = -e "/dev/$_" && fsedit::typeOfPart("/dev/$_");
{ device => $_,
type => $type || 0x83,
- size => (split(':', `lvdisplay -D -c $_`))[6] }
- } map { /^LV Name\s+(\S+)/ ? $1 : () } `vgdisplay -v -D $lvm->{LVMname}`
+ size => (split(':', `lvdisplay -D -c /dev/$_`))[6] }
+ } map { m|^LV Name\s+/dev/(\S+)| ? $1 : () } `vgdisplay -v -D $lvm->{LVMname}`
];
}
@@ -93,7 +93,7 @@ sub vg_destroy {
sub lv_delete {
my ($lvm, $lv) = @_;
- run_program::run_or_die('lvremove', '-f', $lv->{device});
+ run_program::run_or_die('lvremove', '-f', "/dev/$lv->{device}");
my $list = $lvm->{primary}{normal};
@$list = grep { $_ != $lv } @$list;
@@ -103,11 +103,17 @@ sub lv_create {
my ($lvm, $lv) = @_;
my $list = $lvm->{primary}{normal};
my $nb = 1 + max(map { basename($_->{device}) } @$list);
- $lv->{device} = "/dev/$lvm->{LVMname}/$nb";
+ $lv->{device} = "$lvm->{LVMname}/$nb";
run_program::run_or_die('lvcreate', '--size', int($lv->{size} / 2) . 'k', '-n', $nb, $lvm->{LVMname});
$lv->{notFormatted} = 1;
$lv->{isFormatted} = 0;
push @$list, $lv;
}
+sub lv_resize {
+ my ($lv, $oldsize) = @_;
+ run_program::run_or_die($oldsize > $lv->{size} ? ('lvreduce', '-f') : 'lvextend',
+ '--size', int($lv->{size} / 2) . 'k', "/dev/$lv->{device}");
+}
+
1;