Comment 0 for bug 2011927

Revision history for this message
Corey Bryant (corey.bryant) wrote :

ovn-chassis workload status lists deferred events for another charm that is deployed on the same machine (in this case neutron-openvswitch):
Unit Workload Agent Machine Public address Message
nova-compute/0* active idle 8 10.5.3.226 Unit is ready
  neutron-openvswitch/1 maintenance idle 10.5.3.226 Paused. Use 'resume' action to resume normal service.
  ovn-chassis/1 active idle 10.5.3.226 Services queued for stop: ovs-record-hostname.service, ovs-vswitchd.service, ovsdb-server.service

where:
ubuntu@juju-2fd1c1-zaza-7b0a28b01698-8:/var/lib/policy-rc.d$ ls
charm-neutron-openvswitch-2d250424-c3fa-11ed-b824-a369432994da.deferred charm-neutron-openvswitch-2d36e1b2-c3fa-11ed-b824-a369432994da.deferred charm-neutron-openvswitch-2d49221e-c3fa-11ed-b824-a369432994da.deferred

ubuntu@juju-2fd1c1-zaza-7b0a28b01698-8:/var/lib/policy-rc.d$ cat *
action: stop
policy_requestor_name: neutron-openvswitch
policy_requestor_type: charm
reason: Package update
service: ovsdb-server.service
timestamp: 1678971478
action: stop
policy_requestor_name: neutron-openvswitch
policy_requestor_type: charm
reason: Package update
service: ovs-vswitchd.service
timestamp: 1678971479
action: stop
policy_requestor_name: neutron-openvswitch
policy_requestor_type: charm
reason: Package update
service: ovs-record-hostname.service
timestamp: 1678971479

charm-helpers code:
get_deferred_events() # charmhelpers/contrib/openstack/files/check_deferred_restarts.py
This gets all deferred files regardless of file name including service:
  52 deferred_events_files = glob.glob(
  53 '{}/*.deferred'.format(DEFERRED_EVENTS_DIR))

which is probably find since the contents of the files contains the service name:
  37 {
  38 action: restart,
  39 policy_requestor_name: rabbitmq-server,
  40 policy_requestor_type: charm,
  41 reason: 'Pkg update',
  42 service: rabbitmq-server,
  43 time: 1614328743
  44 }

This can probably be fixed in custom_assess_status_check() in lib/charms/ovn_charm.py by updating the events dict *only* with deferred events that match the ovn-chassis service:

 132 def custom_assess_status_check(self):
 133 """Report deferred events in charm status message."""
 134 state = None
 135 message = None
 136 deferred_events.check_restart_timestamps()
 137 events = collections.defaultdict(set)
 138 for e in deferred_events.get_deferred_events():
                 # add a check here
 139 events[e.action].add(e.service)