[pve-devel] [PATCH ha-manager 02/11] resources: add get_static_stats() method

Fiona Ebner f.ebner at proxmox.com
Wed Nov 16 09:46:52 CET 2022


Am 15.11.22 um 14:28 schrieb Thomas Lamprecht:
> Am 10/11/2022 um 15:37 schrieb Fiona Ebner:
>> +    return {
>> +	maxcpu => $conf->{cpulimit} || $conf->{cores} || 0,
>> +	maxmem => ($conf->{memory} || 512) * 1024 * 1024,
> 
> nit, would prefer one of snake or kebab case for those keys (no hard feeling on which
> one, should just be consistent within similar (i.e., the stats) stuff.
> 
>> +    };
>> +}
>> +
>>  1;
>> diff --git a/src/PVE/HA/Resources/PVEVM.pm b/src/PVE/HA/Resources/PVEVM.pm
>> index 58c83e0..85196ed 100644
>> --- a/src/PVE/HA/Resources/PVEVM.pm
>> +++ b/src/PVE/HA/Resources/PVEVM.pm
>> @@ -173,4 +173,18 @@ sub remove_locks {
>>      return undef;
>>  }
>>  
>> +sub get_static_stats {
>> +    my ($class, $id, $service_node) = @_;
>> +
>> +    my $conf = PVE::QemuConfig->load_config($id, $service_node);
> 
> maybe it could be worth to use the CFS_IPC_GET_GUEST_CONFIG_PROPERTY successor that
> Dominik developed for the tags stuff once applied for this, can be still switched too
> transparently, if this shows to be a bottleneck in the future though, so just mentioning
> for completeness sake.
> 

Sure, will be worth a test!

>> +    my $defaults = PVE::QemuServer::load_defaults();
>> +
>> +    my $cpus = ($conf->{sockets} || $defaults->{sockets}) * ($conf->{cores} || $defaults->{cores});
>> +
>> +    return {
>> +	maxcpu => $conf->{vcpus} || $cpus,
>> +	maxmem => ($conf->{memory} || $defaults->{memory}) * 1024 * 1024,
> 
> same here. As this is just internal we can also adapt it later though..
> 

Well, the Rust backend also uses 'maxcpu' and 'maxmem' currently :/
So at least in Usage/Static.pm, it will be more difficult to change later.





More information about the pve-devel mailing list