[pve-devel] [PATCH guest-common] increase max reading replication state file size.

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Apr 16 16:44:59 CEST 2019


On 4/16/19 3:37 PM, Wolfgang Link wrote:
> In this file, the error of a failed job will also be stored.
> The default 32768 bytes are not very much.
> 
> This file is on the local filesystem so there is no filesystem
> size restrictions like in /etc/pve.

looks OK, minor nit inside


> ---
>  PVE/ReplicationState.pm | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/ReplicationState.pm b/PVE/ReplicationState.pm
> index 75d34ba..2bf4fc9 100644
> --- a/PVE/ReplicationState.pm
> +++ b/PVE/ReplicationState.pm
> @@ -31,7 +31,8 @@ sub read_state {
>  
>      return {} if ! -e $state_path;
>  
> -    my $raw = PVE::Tools::file_get_contents($state_path);
> +    # max file size = 1048476 = 1MB
> +    my $raw = PVE::Tools::file_get_contents($state_path, 1048476);

you could maybe write this as 1024 * 1024, making it clearer even
without comment, it's what we often use for such byte numbers.
I mean 1<<20; would work too (and as a guy coming from embedded systems
I even like that more, but it's not as widely used in our code base,
so I guess I'm rather alone here ^^) 

>  
>      return {} if $raw eq '';
>  
> 





More information about the pve-devel mailing list