add check to resize disk if current size could not be determined

This check ensures that disks aren't unintentionally shrunken, if the
size is zero due to an underlying problem.
This commit is contained in:
Tim Marx 2019-09-12 12:56:18 +02:00 committed by Thomas Lamprecht
parent fda7291362
commit f8b829aaba

View File

@ -3579,6 +3579,8 @@ __PACKAGE__->register_method({
PVE::Storage::activate_volumes($storecfg, [$volid]);
my $size = PVE::Storage::volume_size_info($storecfg, $volid, 5);
die "Size of volume $volid couldn't be determined\n" if (!defined($size));
die "internal error" if $sizestr !~ m/^(\+)?(\d+(\.\d+)?)([KMGT])?$/;
my ($ext, $newsize, $unit) = ($1, $2, $4);
if ($unit) {