[pve-devel] [PATCH manager v3 14/14] fix #6068: ui: utils: calculate and render host memory usage correctly

Dominik Csapak d.csapak at proxmox.com
Mon Jul 21 14:52:08 CEST 2025


IMHO this and the last patch should be combined, since they don't really
make sense without each other..

one comment inline:

On 7/15/25 16:32, Aaron Lauterer wrote:
> First by using the new memhost field if guest is of type qemu and the field is
> numerical.
> Second by checking in the render function against the 'value' that has
> been calculated if we have percentages or bytes. Previously we always
> checked the raw record mem data.
> 
> As a result, if the cluster is in a mixed PVE8 / PVE9 situation, for
> example during a migration, we will not report any host memory usage, in
> numbers or percent, as we don't get the memhost metric from the older
> PVE8 hosts.
> 
> Fixes: #6068 (Node Search tab incorrect Host memory usage %)
> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
> ---
>   www/manager6/Utils.js | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
> index 29334111..ed41714a 100644
> --- a/www/manager6/Utils.js
> +++ b/www/manager6/Utils.js
> @@ -1166,6 +1166,9 @@ Ext.define('PVE.Utils', {
>                   return -1;
>               }
>   
> +            if (data.type === 'qemu' && Ext.isNumeric(data.memhost)) {
> +                return data.memhost / maxmem;
> +            }
>               return data.mem / maxmem;
>           },
>   
> @@ -1206,9 +1209,12 @@ Ext.define('PVE.Utils', {
>               var node = PVE.data.ResourceStore.getAt(index);
>               var maxmem = node.data.maxmem || 0;
>   
> -            if (record.data.mem > 1) {
> +            if (value > 1) {

looking at the code, this 'value' seems to be the calculated
'hostmemuse' value, which is calculated by 'calculate_hostmem_usage' and
i don't see how that could ever return a value > 1?
(it basically calculates 'memory' / 'host max memory'  which will always 
be >= 0 and <= 1)

so this change seems wrong to me?

>                   // we got no percentage but bytes
>                   let mem = record.data.mem;
> +                if (record.data.type === 'qemu' && Ext.isNumeric(record.data.memhost)) {
> +                    mem = record.data.memhost;
> +                }
>                   if (!record.data.uptime || maxmem === 0 || !Ext.isNumeric(mem)) {
>                       return '';
>                   }





More information about the pve-devel mailing list