[pve-devel] [PATCH container] Always determine the size of the volume in volume_rescan

Fabian Ebner f.ebner at proxmox.com
Tue Dec 3 09:31:28 CET 2019


Otherwise there is an issue when resizing a volume with pending changes:
1. Have a running container with a mount point
2. Edit the mount point and change the path
3. Resize the mount point
4. Reboot the container
Result: the old size is written to the config.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

An other solution would be to disable the resize button when there are
pending changes. This is what we do for VMs.

 src/PVE/LXC/Config.pm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index ffc5911..760ec23 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1307,8 +1307,7 @@ sub vmconfig_apply_pending {
 my $rescan_volume = sub {
     my ($storecfg, $mp) = @_;
     eval {
-	$mp->{size} = PVE::Storage::volume_size_info($storecfg, $mp->{volume}, 5)
-	    if !defined($mp->{size});
+	$mp->{size} = PVE::Storage::volume_size_info($storecfg, $mp->{volume}, 5);
     };
     warn "Could not rescan volume size - $@\n" if $@;
 };
-- 
2.20.1





More information about the pve-devel mailing list