summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2016-07-08 11:44:16 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2016-07-12 14:14:00 +0200
commit532fd1d60df306e204bae79c5158ca2302739966 (patch)
tree04431846aaa923fe0a372bb722a8fa8979d67ffb /perl-install/partition_table
parentc0d5615fd3e1f76304cd2b53e6625a7b7f94e602 (diff)
downloaddrakx-532fd1d60df306e204bae79c5158ca2302739966.tar
drakx-532fd1d60df306e204bae79c5158ca2302739966.tar.gz
drakx-532fd1d60df306e204bae79c5158ca2302739966.tar.bz2
drakx-532fd1d60df306e204bae79c5158ca2302739966.tar.xz
drakx-532fd1d60df306e204bae79c5158ca2302739966.zip
sync libparted view with diskdrake one
in order to prevent overlapping errors when adding partitions: (b/c libparted doesn't know that diskdrake already removed the partitions in its memory view) "failed to add partition #1 on /dev/vda" "Error: Can't have overlapping partitions." "add_partition failed"
Diffstat (limited to 'perl-install/partition_table')
-rw-r--r--perl-install/partition_table/gpt.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm
index c5af99275..47cfa842e 100644
--- a/perl-install/partition_table/gpt.pm
+++ b/perl-install/partition_table/gpt.pm
@@ -79,6 +79,9 @@ sub write {
$partitions_killed = 1;
}
+ # sync libparted view with diskdrake one in order to prevent overlapping errors when adding partitions:
+ c::disk_delete_all($hd->{file}) if delete $hd->{sync_with_libparted};
+
foreach (@{$hd->{will_tell_kernel}}) {
my ($action, $part_number, $o_start, $o_size) = @$_;
my ($part) = grep { $_->{start} == $o_start && $_->{size} == $o_size } @$pt;
@@ -113,6 +116,8 @@ sub write {
sub initialize {
my ($class, $hd) = @_;
+ # sync libparted view with diskdrake one in order to prevent overlapping errors when adding partitions:
+ $hd->{sync_with_libparted} = 1;
# part_number starts at 1
my @raw = map { +{ part_number => $_ + 1 } } 0..$nb_primary-2;
$hd->{primary} = { raw => \@raw };