Unable to remove resources

Bug #1953623 reported by Martin Kalcok
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
charm-interface-hacluster
Fix Released
Undecided
Martin Kalcok

Bug Description

I think it's currently not possible to remove crm resources created via this interface.

Root of the problem is that method `ResourceManagement.manage_resources`, which updates relation data with `hacluster` charm, updates only fields if they have value locally (see this condition [1]). So if resource gets removed on the "require" side of the relation, it gets added to the "json_delete_reosurces", but it also stays in the "json_resources" and "json_resource_params" on the "provide" side of the relation. This results in resource being removed and then immediately added back again.

To illustrate, I was trying to implement following workflow:

Start with no resources configured -> Add resource named "service_ip_10.5.200.20" -> Remove resource "serice_ip_10.5.200.20".

And following are the snippets of the relation data in the "hacluster" charm.

No resources configured:
```
data:
  egress-subnets: 10.5.0.59/32
  ingress-address: 10.5.0.59
  private-address: 10.5.0.59
```

Resource Added
```
data:
  egress-subnets: 10.5.0.252/32
  ingress-address: 10.5.0.252
  json_resource_params: '{"service_ip_10.5.200.20": " params ip=10.5.200.20 op
    monitor interval=\"10s\""}'
  json_resources: '{"service_ip_10.5.200.20": "ocf:heartbeat:IPaddr2"}'
  private-address: 10.5.0.252
```

Resource Removed
```
data:
  corosync_mcastport: "4440"
  egress-subnets: 10.5.0.252/32
  ingress-address: 10.5.0.252
  json_delete_resources: '["service_ip_10.5.200.20"]'
  json_resource_params: '{"service_ip_10.5.200.20": " params ip=10.5.200.20 op
    monitor interval=\"10s\""}'
  json_resources: '{"service_ip_10.5.200.20": "ocf:heartbeat:IPaddr2"}'
```

Martin.
---

[1] https://github.com/openstack/charm-interface-hacluster/blob/8125a7baecccf9b0869e515b92300dde3a86f31b/interface_hacluster/common.py#L87

Changed in charm-interface-hacluster:
status: New → In Progress
Revision history for this message
Martin Kalcok (martin-kalcok) wrote :
Changed in charm-interface-hacluster:
assignee: nobody → Martin Kalcok (martin-kalcok)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-interface-hacluster (master)

Reviewed: https://review.opendev.org/c/openstack/charm-interface-hacluster/+/821558
Committed: https://opendev.org/openstack/charm-interface-hacluster/commit/56710fdaf4ece82fd4febef8ed49b6e7c084d909
Submitter: "Zuul (22348)"
Branch: master

commit 56710fdaf4ece82fd4febef8ed49b6e7c084d909
Author: Martin Kalcok <email address hidden>
Date: Mon Dec 13 14:19:43 2021 +0100

    Update relation data even if the new value is empty

    This will enable removal of previously created
    resources. Originaly, the empty values were not
    propagated so the resource ended up in both fields
    "json_delete_resources" and "json_resources".

    Closes-Bug: #1953623
    Change-Id: I34693bb0e30bce96144a983e55e212e27029ba52

Changed in charm-interface-hacluster:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.