[pve-devel] cluster resource scheduler question

Fiona Ebner f.ebner at proxmox.com
Wed Nov 23 12:28:12 CET 2022


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






More information about the pve-devel mailing list