]> git.proxmox.com Git - pve-container.git/blobdiff - src/PVE/CLI/pct.pm
don't leave fstrim lock if mount_all fails
[pve-container.git] / src / PVE / CLI / pct.pm
index ab7af33b57c5d8986eb72492b5fdb9cadddc3505..35ad72fbb21737d61f70b40cfa159f88a86236c2 100755 (executable)
@@ -1,5 +1,5 @@
 package PVE::CLI::pct;
-    
+
 use strict;
 use warnings;
 
@@ -20,8 +20,6 @@ use PVE::API2::LXC::Config;
 use PVE::API2::LXC::Status;
 use PVE::API2::LXC::Snapshot;
 
-use Data::Dumper;
-
 use base qw(PVE::CLIHandler);
 
 my $nodename = PVE::INotify::nodename();
@@ -776,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};
@@ -786,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');