]> git.proxmox.com Git - pve-container.git/commitdiff
Fix #791: warn when resize2fs fails
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 8 Feb 2016 07:48:25 +0000 (08:48 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 8 Feb 2016 10:58:19 +0000 (11:58 +0100)
At this point the underlying file has already been
successfully resized which means it makes sense to refelct
that change in the config, but the guest will not see the
effect of it, however, a subsequent resize command will
further increase the size relative to the 'new' size, so
after such an error the best option is to manually deal with
the error and perform the necessary resize steps.

src/PVE/API2/LXC.pm

index 09b71c880bda86dba3a6c8c218d7b0f1d8036020..7db8488cd5b12e3c31bfecaf38968039e3b8001f 100644 (file)
@@ -1317,10 +1317,16 @@ __PACKAGE__->register_method({
                        # interestingly we don't need to e2fsck on mounted systems...
                        my $quoted = PVE::Tools::shellquote($path);
                        my $cmd = "mount --make-rprivate / && mount $quoted /tmp && resize2fs $quoted";
-                       PVE::Tools::run_command(['unshare', '-m', '--', 'sh', '-c', $cmd]);
+                       eval {
+                           PVE::Tools::run_command(['unshare', '-m', '--', 'sh', '-c', $cmd]);
+                       };
+                       warn "Failed to update the container's filesystem: $@\n" if $@;
                    } else {
-                       PVE::Tools::run_command(['e2fsck', '-f', '-y', $path]);
-                       PVE::Tools::run_command(['resize2fs', $path]);
+                       eval {
+                           PVE::Tools::run_command(['e2fsck', '-f', '-y', $path]);
+                           PVE::Tools::run_command(['resize2fs', $path]);
+                       };
+                       warn "Failed to update the container's filesystem: $@\n" if $@;
                    }
                }
            };