[pve-devel] [PATCH ha-manager 07/15] manager: read and update rules config

Daniel Kral d.kral at proxmox.com
Tue Apr 29 10:04:25 CEST 2025


On 4/25/25 16:30, Fiona Ebner wrote:
> Am 25.03.25 um 16:12 schrieb Daniel Kral:
>> +    my $new_rules = $haenv->read_rules_config();
>> +
>> +    # TODO We should also check for a service digest here, but we would've to
>> +    #      calculate it here independently or also expose it through read_service_config()
> 
> Ah, so read_and_check_resources_config() drops the digest and produces a
> hash with the only keys being the $sids. Easiest is probably to add
> wantarray in the relevant place(s) and return a list with the digest
> second. And I guess we don't need that anymore after we migrated from HA
> groups to location rules, since it's only used to get the groups? If
> yes, then we should add a reminder to remove it again.

Yes, the digest for services and HA groups shouldn't be needed anymore 
as soon as we migrate the groups to be location rules. I'll expose it 
through read_and_check_resources_config() as you suggested and add the 
TODOs for removing it later.

> 
>> +    if ($new_rules->{digest} ne $self->{last_rules_digest}
>> +	|| $self->{groups}->{digest} ne $self->{last_groups_digest}) {
>> +	$self->{rules} = $new_rules;
>> +	PVE::HA::Rules::checked_config($self->{rules}, $self->{groups}, $sc);
> 
> Might not matter now, but I'd prefer: check first, then assign.

ACK, will do that!

> 
>> +    }
>> +
>> +    $self->{last_rules_digest} = $self->{rules}->{digest};
>> +    $self->{last_groups_digest} = $self->{groups}->{digest};
>> +
>>       $self->update_crm_commands();
>>   
>>       for (;;) {
> 





More information about the pve-devel mailing list