ceph-changed() unnecessarily restarts nova-compute service as many times as there are ceph-mon units
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Nova Compute Charm |
Fix Released
|
Undecided
|
Rodrigo Barbieri |
Bug Description
The following code is to be found in the config_changed hook of the nova-compute charm:
for rid in relation_
for unit in related_units(rid):
This causes the ceph_changed() function to run once per rid.
ceph_changed() calls is_broker_
if is_request_
# Ensure that nova-compute is restarted since only now can we
# guarantee that ceph resources are ready, but only if not paused.
if (not is_unit_
not is_broker_
else:
If the unit we are processing does not have broker-
rdata = relation_
broker_rsp = rdata.get(
if not broker_rsp:
return False
Therefore the conditional expression in ceph_changed() will evaluate to True, unless the unit is paused, and restart the nova-compute service.
However only the leader has broker-
The non-leader units don't have broker-
ceph-mon/0
{u'auth': u'cephx', u'private-address': u'10.0.0.25', u'broker-
ceph-mon/1
{u'key': u'AQCHhBldMRF3J
..
The upshot is that when jujud-unit-
I would add the code below to remove those unnecessary restarts, and restart only once - when we process the ceph-mon leader:
1) charm-helpers in hooks/charmhelp
def has_broker_
rdata = relation_
broker_rsp = rdata.get(
if not broker_rsp:
return False
return True
2) charm-nova-compute in hooks/nova_
if has_broker_rsp(rid, unit):
if is_request_
# Ensure that nova-compute is restarted since only now can we
# guarantee that ceph resources are ready, but only if not paused.
if (not is_unit_
else:
tags: | added: sts |
Changed in charm-nova-compute: | |
assignee: | nobody → Rodrigo Barbieri (rodrigo-barbieri2010) |
status: | New → In Progress |
Changed in charm-nova-compute: | |
assignee: | Rodrigo Barbieri (rodrigo-barbieri2010) → nobody |
Changed in charm-nova-compute: | |
assignee: | nobody → Rodrigo Barbieri (rodrigo-barbieri2010) |
Changed in charm-nova-compute: | |
status: | Fix Committed → Fix Released |
PR for charm-helpers
https:/ /github. com/juju/ charm-helpers/ pull/342