On Tue, Jul 07, 2026 at 09:48:21AM +0200, Denis V. Lunev via Devel wrote:
> Switch max_size from virConfGetValueSizeT() to virConfGetValueBytes(),
> so it accepts "2MiB" the same way domain XML memory sizes do, instead
> of only a raw byte count.
> 
> Signed-off-by: Denis V. Lunev <[email protected]>
> ---
>  src/logging/log_daemon_config.c | 2 +-
>  src/logging/log_daemon_config.h | 2 +-
>  src/logging/virtlogd.conf       | 7 ++++++-
>  3 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/logging/log_daemon_config.c b/src/logging/log_daemon_config.c
> index 60c424ad84..e0d6384818 100644
> --- a/src/logging/log_daemon_config.c
> +++ b/src/logging/log_daemon_config.c
> @@ -91,7 +91,7 @@ virLogDaemonConfigLoadOptions(virLogDaemonConfig *data,
>          return -1;
>      if (virConfGetValueUInt(conf, "admin_max_clients", 
> &data->admin_max_clients) < 0)
>          return -1;
> -    if (virConfGetValueSizeT(conf, "max_size", &data->max_size) < 0)
> +    if (virConfGetValueBytes(conf, "max_size", &data->max_size) < 0)
>          return -1;
>      if (virConfGetValueSizeT(conf, "max_backups", &data->max_backups) < 0)
>          return -1;
> diff --git a/src/logging/log_daemon_config.h b/src/logging/log_daemon_config.h
> index 5c10cc50d7..617b62258b 100644
> --- a/src/logging/log_daemon_config.h
> +++ b/src/logging/log_daemon_config.h
> @@ -32,7 +32,7 @@ struct _virLogDaemonConfig {
>      unsigned int admin_max_clients;
>  
>      size_t max_backups;
> -    size_t max_size;
> +    unsigned long long max_size;
>  
>      char *log_root;
>      size_t max_age_days;
> diff --git a/src/logging/virtlogd.conf b/src/logging/virtlogd.conf
> index 5214e96121..51bc0590ed 100644
> --- a/src/logging/virtlogd.conf
> +++ b/src/logging/virtlogd.conf
> @@ -87,6 +87,11 @@
>  
>  # Maximum file size before rolling over. Defaults to 2 MB
>  #
> +# The value is a plain byte count, or a byte count followed by a unit
> +# suffix: bytes/b, KB/k/KiB, MB/M/MiB, GB/G/GiB, TB/T/TiB, PB/P/PiB, or
> +# EB/E/EiB (decimal 'B' suffixes scale by 1000, binary 'iB' suffixes,
> +# and their bare single-letter equivalents, scale by 1024).
> +#
>  # Setting max_size to zero will disable rollover entirely.
>  # NOTE: disabling rollover exposes the host filesystem to
>  # denial of service from a malicious guest.
> @@ -96,7 +101,7 @@
>  # the logrotate config is a no-op when virtlogd is running,
>  # make sure that max_size here is smaller than size listed
>  # in the logrotate config.
> -#max_size = 2097152
> +#max_size = "2MiB"

This will require an update to virtlogd.aug and test_virtlogd.aug
to allow for string format.

>  
>  # Maximum number of backup files to keep. Defaults to 3,
>  # not including the primary active file
> -- 
> 2.53.0
> 

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|

Reply via email to