charm calling systemctl enable for all services even if they are already enabled
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Charm Helpers |
Fix Committed
|
High
|
Edward Hope-Morley | ||
charm-ovn-chassis |
Fix Committed
|
High
|
Edward Hope-Morley |
Bug Description
Opening a new bug for the issue described in comments in https:/
The charm will run [1] on every update-status hook which in turn calls [2] and then [3]. This results in a call to service_resume() for all services (in this case neutron-
# systemctl enable neutron-
Synchronizing state of neutron-
Executing: /lib/systemd/
[1] https:/
[2] https:/
[3] https:/
[4] https:/
This appears to be default behaviour for any charm that uses layer_openstack since nothing ever unsets the flags that are causing that method to be called each time a hook fires. It can be overridden by the ovn-chassis charm and I feel like perhaps it should be since there is no need to be continuously doing this for a service that is already enabled.
Changed in charm-ovn-chassis: | |
status: | New → Confirmed |
Changed in charm-helpers: | |
status: | In Progress → Fix Committed |
Changed in charm-ovn-chassis: | |
status: | Triaged → In Progress |
Good bit of sleuthing!
I think there's a couple of ways that this could be solved.
1) prevent the function from being called by using a 'gating' flag or similar; i.e. after the service is enable, set a flag that it is enabled. This is a bit tricky as it's essentially caching metadata about the real world, and that may change, whilst the flag stays the same (i.e. an external actor may disable the service).
2) my preference; make the `enable_services` function both idempotent (which is sort of is) but add additional logic to not do the enable for a service if it is already enabled. This will maintain the 'self-repair' aspect of the charm function, but lose the annoying side-effects of continually enabling a service.