During container startup, warnings are written to a file, which is
later logged to the RESTEnvironment. This should also happen in the
presence of errors, so move it outside the eval block.

Signed-off-by: Robert Obkircher <[email protected]>
---
 src/PVE/LXC.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index de54a0d..bf49001 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -3092,10 +3092,10 @@ sub vm_start {
 
         # if debug is requested, print the log it also when the start succeeded
         print_ct_stderr_log($vmid) if $is_debug;
-
-        print_ct_warn_log($vmid); # always print warn log, if any
     };
-    if (my $err = $@) {
+    my $err = $@;
+    print_ct_warn_log($vmid); # always print warn log, if any
+    if ($err) {
         unlink $skiplock_flag_fn;
         die $err;
     }
-- 
2.47.3



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to