[pve-devel] [PATCH v3 container 2/2] add check to resize disk if current size could not be determined

Tim Marx t.marx at proxmox.com
Thu Sep 12 12:56:20 CEST 2019


This check ensures that disks aren't unintentionally shrunken, if the
size is zero due to an underlying problem.
---
 src/PVE/API2/LXC.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index faec445..fbc4659 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1639,6 +1639,9 @@ __PACKAGE__->register_method({
 	    PVE::Storage::activate_volumes($storage_cfg, [$volid]);
 
 	    my $size = PVE::Storage::volume_size_info($storage_cfg, $volid, 5);
+
+	    die "Size of volume $volid couldn't be determined\n" if (!defined($size));
+
 	    $newsize += $size if $ext;
 	    $newsize = int($newsize);
 
-- 
2.20.1




More information about the pve-devel mailing list