[pve-devel] [PATCH ha-manager 1/2] fix #6613: update rules containing the resource to be deleted
Michael Köppl
m.koeppl at proxmox.com
Tue Sep 23 10:06:14 CEST 2025
On Tue Sep 23, 2025 at 9:53 AM CEST, Daniel Kral wrote:
>> src/PVE/HA/Config.pm | 15 ++++++++++++++-
>> 1 file changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/PVE/HA/Config.pm b/src/PVE/HA/Config.pm
>> index 301c62f..9a7ed0e 100644
>> --- a/src/PVE/HA/Config.pm
>> +++ b/src/PVE/HA/Config.pm
>> @@ -419,17 +419,30 @@ sub get_resource_motion_info {
>>
>> # graceful, as long as locking + cfs_write works
>> sub delete_service_from_config {
>> - my ($sid) = @_;
>> + my ($sid, $purge) = @_;
>>
>> return 1 if !service_is_configured($sid);
>>
>> my $res;
>> PVE::HA::Config::lock_ha_domain(
>> sub {
>> +
>> my $conf = read_resources_config();
>> $res = delete $conf->{ids}->{$sid};
>> write_resources_config($conf);
>>
>> + my $rules = read_rules_config();
>
> The {read,write}_rules_config(...) should be included in the
> if ($purge) {} block here
>
Thanks for the taking the time to have a look at this! Missed that one,
will fix in a v2, thanks!
>> +
>> + if ($purge) {
>> + for my $ruleid (keys $rules->{ids}->%*) {
>> + my $rule_resources = $rules->{ids}->{$ruleid}->{resources} // {};
>> +
>> + delete $rule_resources->{$sid};
>> + delete $rules->{ids}->{$ruleid} if !%$rule_resources;
>> + }
>> + }
>> +
>> + write_rules_config($rules);
>> },
>> "delete resource failed",
>> );
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
More information about the pve-devel
mailing list