diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-07-01 06:05:43 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-07-01 06:05:43 +0000 |
commit | f04cae4ca3dea07ce237410905c2b2f731686f5e (patch) | |
tree | 3572e365fcd1f579685266568699003dfc63ffa7 /perl-install | |
parent | 85ee1c68b47036934f2651ac87e3fc49b5293dad (diff) | |
download | drakx-f04cae4ca3dea07ce237410905c2b2f731686f5e.tar drakx-f04cae4ca3dea07ce237410905c2b2f731686f5e.tar.gz drakx-f04cae4ca3dea07ce237410905c2b2f731686f5e.tar.bz2 drakx-f04cae4ca3dea07ce237410905c2b2f731686f5e.tar.xz drakx-f04cae4ca3dea07ce237410905c2b2f731686f5e.zip |
handle vgreduce
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/diskdrake/interactive.pm | 8 | ||||
-rw-r--r-- | perl-install/lvm.pm | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index dfb5c59fb..c98331449 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -885,8 +885,12 @@ sub RemoveFromLVM { my ($_in, $_hd, $part, $all_hds) = @_; isPartOfLVM($part) or die; my ($lvm, $other_lvms) = partition { $_->{VG_name} eq $part->{lvm} } @{$all_hds->{lvms}}; - lvm::vg_destroy($lvm->[0]); - $all_hds->{lvms} = $other_lvms; + if (@{$lvm->[0]{disks}} > 1) { + lvm::vg_reduce($lvm->[0], $part); + } else { + lvm::vg_destroy($lvm->[0]); + $all_hds->{lvms} = $other_lvms; + } } sub ModifyRAID { my ($in, $_hd, $part, $all_hds) = @_; diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm index 3563af941..5fb17e791 100644 --- a/perl-install/lvm.pm +++ b/perl-install/lvm.pm @@ -111,6 +111,16 @@ sub vg_add { lvm_cmd_or_die($prog, $part->{lvm}, $dev); } +sub vg_reduce { + my ($lvm_vg, $part_pv) = @_; + + lvm_cmd('vgchange', '-a', 'n', $lvm_vg->{VG_name}); + lvm_cmd('vgreduce', $lvm_vg->{VG_name}, devices::make($part_pv->{device})) or die N("Physical volume %s is still in use.", $part_pv->{device}); + @{$lvm_vg->{disks}} = difference2($lvm_vg->{disks}, [ $part_pv ]); + delete $part_pv->{lvm}; + set_isFormatted($part_pv, 0); +} + sub vg_destroy { my ($lvm) = @_; |