when a container has a mountpoint which can't be mounted for some reason,
mount_all dies and the fstrim lock stays. prevent this by moving the call into
eval, warn if any error occurs.

Signed-off-by: Oguz Bektas <o.bek...@proxmox.com>
---
 src/PVE/CLI/pct.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 8807633..35ad72f 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -774,9 +774,9 @@ __PACKAGE__->register_method ({
 
        my $storecfg = PVE::Storage::config();
        my $conf = PVE::LXC::Config->set_lock($vmid, 'fstrim');
-       PVE::LXC::mount_all($vmid, $storecfg, $conf);
        eval {
            my $path = "";
+           PVE::LXC::mount_all($vmid, $storecfg, $conf);
            PVE::LXC::Config->foreach_mountpoint($conf, sub {
                my ($name, $mp) = @_;
                $path = $mp->{mp};
@@ -784,6 +784,7 @@ __PACKAGE__->register_method ({
                PVE::Tools::run_command($cmd);
            });
        };
+       warn $@ if $@;
 
        PVE::LXC::umount_all($vmid, $storecfg, $conf, 0);
        PVE::LXC::Config->remove_lock($vmid, 'fstrim');
-- 
2.20.1

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to