[pve-devel] [PATCH qemu-server 9/9] add check to resize disk if current size could not be determined

Oguz Bektas o.bektas at proxmox.com
Fri Nov 15 14:59:03 CET 2019


From: Tim Marx <t.marx at proxmox.com>

This check ensures that disks aren't unintentionally shrunken, if the
size is zero due to an underlying problem.

(cherry picked from commit f8b829aabae2fdc8bdd9ace741bbef3598b892f2)
Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 PVE/API2/Qemu.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index ae3e67d..0bc5ae5 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3433,6 +3433,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) {
-- 
2.20.1




More information about the pve-devel mailing list