]> git.proxmox.com Git - pve-container.git/commitdiff
fixup: always un-map and comment more
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 11 Mar 2019 08:39:46 +0000 (09:39 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 11 Mar 2019 08:39:46 +0000 (09:39 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/API2/LXC.pm

index 1cbd3d83b82fe365c3cf03598bbcffff5a54941d..2c4a3d553b583467f1140dcd508bf944214f8f76 100644 (file)
@@ -1606,7 +1606,9 @@ __PACKAGE__->register_method({
                PVE::LXC::Config->write_config($vmid, $conf);
 
                if ($format eq 'raw') {
-                   my $path = PVE::Storage::map_volume($storage_cfg, $volid) // PVE::Storage::path($storage_cfg, $volid);
+                   # we need to ensure that the volume is mapped, if not needed this is a NOP
+                   my $path = PVE::Storage::map_volume($storage_cfg, $volid);
+                   $path = PVE::Storage::path($storage_cfg, $volid) if !defined($path);
                    if ($running) {
 
                        $mp->{mp} = '/';
@@ -1635,8 +1637,9 @@ __PACKAGE__->register_method({
                        };
                        warn "Failed to update the container's filesystem: $@\n" if $@;
 
-                       PVE::Storage::unmap_volume($storage_cfg, $volid);
                    }
+                   # always un-map, this is a NOP if not needed
+                   PVE::Storage::unmap_volume($storage_cfg, $volid);
                }
            };