[pve-devel] applied: [PATCH common v4] return whole log file if limit is 0

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Nov 24 17:24:38 CET 2022


Am 23/11/2022 um 15:52 schrieb Daniel Tschlatscher:
> The dump_logfile now returns the whole log file if the limit parameter
> is set to 0. This must be done explicitely though, as in the case of
> 'limit' being undefined, the default as before, 50 will be used.
> 
> Signed-off-by: Daniel Tschlatscher <d.tschlatscher at proxmox.com>
> ---
> Changes from v3:
> * NEW patch
> 
> This patch also affects the API endpoints for:
> * the ceph log file
> * replication log files
> * firewall Guest and Host log files
> 
> It does not change how they behave in the GUI though, as all of the
> corresponding API calls there do not specify a 'limit=0' parameter.
> In fact, none of them specify any limit, therefore, the default value
> of 50 still applies.
> 
>  src/PVE/Tools.pm | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)


applied, thanks!

> 
> diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
> index eb81b96..6072eb7 100644
> --- a/src/PVE/Tools.pm
> +++ b/src/PVE/Tools.pm
> @@ -1278,9 +1278,10 @@ sub dump_logfile {
>  	return ($count, $lines);
>      }
>  
> -    $start = 0 if !$start;
> -    $limit = 50 if !$limit;
> +    $start = $start // 0;
> +    $limit = $limit // 50;
>  
> +    my $read_until_end = ($limit == 0) ? 1 : 0;

no need for transform booleans to booleans ;-)





More information about the pve-devel mailing list