Comment 6 for bug 1915512

Revision history for this message
Hua Zhang (zhhuabj) wrote :

@Felipe, thanks for your suggestion, I've implemented it in patchset 3, but there
are still the following problems.

We have two operations, delete_hm_port and update_neutron_ip_list, the data
departing_unit_name is required for both operations, and it can only be
obtained from octavia/1.
(suppose departing unit is octavia/7 and leader unit is octavia/1).

So

octavia/7 should run cluster-departed hook to obtain departing_unit_name

@reactive.when_not('cluster.connected')
def cluster_departed():
    if hookenv.local_unit() == hookenv.departing_unit():
        # run delete_hm_port here

and octavia/1 should be running cluster-relation-changed hook and/or
cluster-broken and cluster-departed to run existing update_neutron_ip_list

...
+@reactive.when_not('cluster.connected')
def update_controller_ip_port_list():
    # run existing update_neutron_ip_list here

Now the question will be:

1, We can use relation_set() to pass departing_unit_name from octavia/7
to octavia/3

2, but how to pass event from octavia/7 to octavia/3 to trigger
update_controller_ip_port_list after running cluster_departed.
because it seems the above proposal can't guarantee the order to first run
cluster_departed then run update_controller_ip_port_list

Do you guys have any ideas to find a better solution for this? thanks.