]> git.proxmox.com Git - qemu-server.git/commitdiff
add check to resize disk if current size could not be determined
authorTim Marx <t.marx@proxmox.com>
Thu, 12 Sep 2019 10:56:18 +0000 (12:56 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 23 Sep 2019 16:25:01 +0000 (18:25 +0200)
This check ensures that disks aren't unintentionally shrunken, if the
size is zero due to an underlying problem.

PVE/API2/Qemu.pm

index 6609c3558b6a686fd04a924de7f54baf9897c976..5bd340726308fc61e6e5309f233494ac4be21b57 100644 (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) {