[pve-devel] [PATCH container] don't leave fstrim lock if mount_all fails
Oguz Bektas
o.bektas at proxmox.com
Mon Aug 26 16:06:32 CEST 2019
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.bektas at 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
More information about the pve-devel
mailing list