Cluster binding change results in config-changed hook error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
memcached-charm |
Triaged
|
Low
|
Unassigned |
Bug Description
This is slightly a corner case, however when the unit's cluster binding is getting updated into a different network space with the "juju bind" command, the config-changed hook is failing with the following stack trace:
unit-memcached-0: 14:26:42 DEBUG unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 WARNING unit.memcached/
unit-memcached-0: 14:26:42 ERROR juju.worker.
Memcached is keeping the cluster ip values from the former network space in the /var/run/
$ juju run -a memcached "cat /var/run/
- Stdout: |
10.
UnitId: memcached/0
- Stdout: |
10.
UnitId: memcached/1
and the charm cannot decide about the master and secondary roles, as the cluster ip address from the new network space, won't match the ips stored in repcached_replica:
def get_current_
replica = get_repcached_
if replica:
master, secondary = replica
ip_addr = get_relation_
if ip_addr == master:
replica = secondary
elif ip_addr == secondary:
replica = master
Workaround: update the repcached_replica content on each memcached unit using the unit ip addresses from the new network space:
identify ip addresses of the cluster binding:
$ juju run -a memcached "network-get --primary-address cluster"
- Stdout: |
10.99.40.102
UnitId: memcached/0
- Stdout: |
10.99.40.156
UnitId: memcached/1
upgrade the content of the /var/run/
$ juju run -a memcached 'echo -n "10.99.
Resolve the units:
$ juju resolve memcached/0
$ juju resolve memcached/1
Changed in charm-memcached: | |
importance: | Undecided → Low |
status: | New → Triaged |