[pve-devel] cluster resource scheduler question

DERUMIER, Alexandre Alexandre.DERUMIER at groupe-cyllene.com
Wed Nov 23 13:18:55 CET 2022


Ah ok, got it, thanks.

I had totally missed HA/Usage/Static.pm , which is used in
recompute_online_node_usage.


I was a bit lost between perl && rust, but I begin to understand how
it's working.  (Nice code BTW ;)




Le mercredi 23 novembre 2022 à 12:28 +0100, Fiona Ebner a écrit :
> 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://antiphishing.cetsi.fr/proxy/v3?i=d1l4NXNNaWE4SWZqU0dLWcuTfdxEd98NfWIp9dma5kY&r=MXJUa0FrUVJqc1UwYWxNZ8tuXduEO8AMVnCPQXMJjAacdo9GABnHjKxpaZ5vEHCU6zVrUZu3S1lZhwcGmwx2yA&f=c2xMdVN4Smh2R2tOZDdIRLb87S4icH52IJimWEw_GeUm5GbjoNM9wfgv6zQHlbuo&u=https%3A//git.proxmox.com/%3Fp%3Dproxmox-perl-rs.git%3Ba%3Dblob%3Bf%3Dpve-rs/src/resource_scheduling/static.rs%3Bh%3Dc47dcd3477eb75d7c7f14c7c4d914179a549430e%3Bhb%3DHEAD&k=fjzS
> 
> 



More information about the pve-devel mailing list