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

Tim Marx t.marx at proxmox.com
Mon Sep 9 12:10:04 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..f08b6a5 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 "volume $volid does not exists\n" if !$size;
+
 	    $newsize += $size if $ext;
 	    $newsize = int($newsize);
 
-- 
2.20.1




More information about the pve-devel mailing list