[pve-devel] [PATCH v4 pve-container 1/5] Ensure that container startup warnings are displayed if startup fails.

Robert Obkircher r.obkircher at proxmox.com
Mon Nov 17 12:30:51 CET 2025


On 11/13/25 17:14, Fiona Ebner wrote:
> Am 13.11.25 um 4:04 PM schrieb Robert Obkircher:
>> 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 <r.obkircher at proxmox.com>
>> ---
>>   src/PVE/LXC.pm | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
>> index 89ccb54..44e20bc 100644
>> --- a/src/PVE/LXC.pm
>> +++ b/src/PVE/LXC.pm
>> @@ -2976,10 +2976,12 @@ sub vm_start {
>>   
>>           # if debug is requested, print the log it also when the start succeeded
>>           print_ct_stderr_log($vmid) if $is_debug;
> Should the same be done for the error log here?
This is only for debug output in case of success. The preceding call 
already prints the log if it dies.

>
>> -
>> +    };
>> +    my $err = $@;
>> +    eval {
>>           print_ct_warn_log($vmid); # always print warn log, if any
>>       };
> Nit: looking at the implementation of print_ct_warn_log(), it already
> seems like it's written to avoid die-ing, so we could avoid the eval
> here. Otherwise, I'd add a comment stating that the error from this eval
> is ignored on purpose, but again, I don't think we need the eval here.
I will remove the eval.
>
>> -    if (my $err = $@) {
>> +    if ($err) {
>>           unlink $skiplock_flag_fn;
>>           die $err;
>>       }




More information about the pve-devel mailing list