From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.ebner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id A3EDAB18D
 for <pve-devel@lists.proxmox.com>; Wed, 23 Nov 2022 12:28:45 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 8308D21AC1
 for <pve-devel@lists.proxmox.com>; Wed, 23 Nov 2022 12:28:15 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Wed, 23 Nov 2022 12:28:13 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8AB3244A78;
 Wed, 23 Nov 2022 12:28:13 +0100 (CET)
Message-ID: <cddc78c7-b6a8-e5e6-d0e9-ecb21775b80b@proxmox.com>
Date: Wed, 23 Nov 2022 12:28:12 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.5.0
Content-Language: en-US
To: pve-devel@lists.proxmox.com,
 "DERUMIER, Alexandre" <Alexandre.DERUMIER@groupe-cyllene.com>
References: <19713dd51749ed24a5ecda1c6930191ed8fc4c11.camel@groupe-cyllene.com>
 <0606073a4b72f9a06bbb83e5f2bcb36a9ed24ccd.camel@groupe-cyllene.com>
From: Fiona Ebner <f.ebner@proxmox.com>
In-Reply-To: <0606073a4b72f9a06bbb83e5f2bcb36a9ed24ccd.camel@groupe-cyllene.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.027 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.001 Looks like a legit reply (A)
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] cluster resource scheduler question
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 23 Nov 2022 11:28:45 -0000

Am 23.11.22 um 11:18 schrieb DERUMIER, Alexandre:
> After doing some test, 
> 
> 
> if I understand, the node static infos max-mem, max-cpu are only used
> to have percents to be able to compare each node.
> 
> and the nodeusage is compute with the sum of static mem/cpu of the
> services running on this node.
> 
> But I really don't see where it's node in the rust code ?
> 
> 
> I see a 
> 
> +impl StaticNodeUsage {
> +    /// Add usage of `service` to the node's usage.
> +    pub fn add_service_usage(&mut self, service: &StaticServiceUsage)
> {
> +        self.cpu = add_cpu_usage(self.cpu, self.maxcpu as f64,
> service.maxcpu);
> +        self.mem += service.maxmem;
> +    }
> +}
> 
> 
> But I don't see where it's called ?

The Perl code calls into the PVE::RS::ResourceScheduling module. That
module acts as a FFI (generated by perlmod) for the Rust code in [0].
That Rust code then calls into the proxmox-resource-scheduling crate.
For example, at line 93, it calls the method you mentioned.

[0]
https://git.proxmox.com/?p=proxmox-perl-rs.git;a=blob;f=pve-rs/src/resource_scheduling/static.rs;h=c47dcd3477eb75d7c7f14c7c4d914179a549430e;hb=HEAD