[pve-devel] [PATCH container v3] Fix #2109: resize rbd volume for container failed

Alwin Antreich a.antreich at proxmox.com
Fri Mar 8 15:11:54 CET 2019


On resizing a container's disk image the filesystem is extended and in
the case of RBD the returned path of the volume was not a path to a
mapped device.

This patch uses map_volume (respectively unmap_volume) to get a device
mapped and its path returned by the storage plugin. If a path is not
returned then the path method is tried. Currently only the RBD storage
plugin returns a path on map_volume.

Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
 src/PVE/API2/LXC.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 27d26d5..e791106 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1602,7 +1602,7 @@ __PACKAGE__->register_method({
 		PVE::LXC::Config->write_config($vmid, $conf);
 
 		if ($format eq 'raw') {
-		    my $path = PVE::Storage::path($storage_cfg, $volid, undef);
+		    my $path = PVE::Storage::map_volume($storage_cfg, $volid) // PVE::Storage::path($storage_cfg, $volid);
 		    if ($running) {
 
 			$mp->{mp} = '/';
@@ -1631,6 +1631,7 @@ __PACKAGE__->register_method({
 			};
 			warn "Failed to update the container's filesystem: $@\n" if $@;
 		    }
+		    PVE::Storage::unmap_volume($storage_cfg, $volid);
 		}
 	    };
 
-- 
2.11.0





More information about the pve-devel mailing list