summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/diskdrake/interactive.pm9
-rw-r--r--perl-install/lvm.pm6
2 files changed, 14 insertions, 1 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index dcccc1c97..285b74d30 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -882,10 +882,17 @@ sub RemoveFromRAID {
raid::removeDisk($all_hds->{raids}, $part);
}
sub RemoveFromLVM {
- my ($_in, $_hd, $part, $all_hds) = @_;
+ my ($in, $_hd, $part, $all_hds) = @_;
isPartOfLVM($part) or die;
my ($lvm, $other_lvms) = partition { $_->{VG_name} eq $part->{lvm} } @{$all_hds->{lvms}};
if (@{$lvm->[0]{disks}} > 1) {
+ my ($used, $_total) = lvm::pv_physical_extents($part);
+ if ($used) {
+ $in->ask_yesorno('', N("Physical volume %s is still in use.
+Do you want to move used physical extents on this volume to other volumes?", $part->{device})) or return;
+ my $_w = $in->wait_message('', N("Moving physical extents"));
+ lvm::pv_move($part);
+ }
lvm::vg_reduce($lvm->[0], $part);
} else {
lvm::vg_destroy($lvm->[0]);
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index 79aac82d9..802096e43 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -77,6 +77,12 @@ sub pv_to_vg {
get_pv_field($pv, 'vg_name') =~ /(\S+)/ && $1;
}
+sub pv_move {
+ my ($pv) = @_;
+ my $dev = expand_symlinks(devices::make($pv->{device}));
+ lvm_cmd('pvmove', '-v', $dev) or die N("Moving used physical extents to other physical volumes failed");
+}
+
sub update_size {
my ($lvm) = @_;
$lvm->{extent_size} = to_int(run_program::get_stdout('lvm2', 'vgs', '--noheadings', '--nosuffix', '--units', 's', '-o', 'vg_extent_size', $lvm->{VG_name}));