[pve-devel] [PATCH v2 container 2/3] pct: fsck: also unmap when fsck command failed

Fiona Ebner f.ebner at proxmox.com
Fri Apr 12 13:08:13 CEST 2024


Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---

New in v2.

 src/PVE/CLI/pct.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 513bcba..13aa4c1 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -299,9 +299,13 @@ __PACKAGE__->register_method ({
 	    }
 
 	    push(@$command, $path);
-	    PVE::Tools::run_command($command);
+	    eval { PVE::Tools::run_command($command); };
+	    my $err = $@;
 
-	    PVE::Storage::unmap_volume($storage_cfg, $volid) if $storage_id;
+	    eval { PVE::Storage::unmap_volume($storage_cfg, $volid) if $storage_id; };
+	    warn $@ if $@;
+
+	    die $err if $err;
 	};
 
 	PVE::LXC::Config->lock_config($vmid, $do_fsck);
-- 
2.39.2





More information about the pve-devel mailing list