Manual testing:
Bootstrapped on 1.22. Upgraded to 1.23. Deployed a container (which allocates an IP address) and then destroyed the container.
Upgraded to this branch. See the following in the logs:
2015-03-31 15:51:52 INFO juju.upgrade upgrade.go:133 running upgrade step: add
life field to IP addresses 2015-03-31 15:51:52 DEBUG juju.state upgrades.go:500
setting life "dead" to address "172.16.0.177" 2015-03-31 15:51:52 INFO
juju.mongo open.go:125 dialled mongo successfully on address "172.16.0.128:37017"
So the "allocated but no longer used" address is detected by the upgrade step and marked as Dead.
Then saw the following in the logs (which probably means this branch isn't ready
to land):
2015-03-31 15:51:53 ERROR juju.worker runner.go:219 exited "addresserworker":
failed to release address 172.16.0.177: cannot get allocated machine "0/lxc/0":
machine 0/lxc/0 not found 2015-03-31 15:51:56 ERROR juju.worker runner.go:219
exited "addresserworker": failed to release address 172.16.0.177: cannot get
allocated machine "0/lxc/0": machine 0/lxc/0 not found 2015-03-31 15:51:59 ERROR
juju.worker runner.go:219 exited "addresserworker": failed to release address
172.16.0.177: cannot get allocated machine "0/lxc/0": machine 0/lxc/0 not found
2015-03-31 15:52:02 ERROR juju.worker runner.go:219 exited "addresserworker":
failed to release address 172.16.0.177: cannot get allocated machine "0/lxc/0":
machine 0/lxc/0 not found
The problem is that to release the IP address we need to know the instance ID
(defined as part of the provider ReleaseAddress signature. And we don't know the
instance ID of an already removed container. So the addressserworker can't
remove Dead addresses that were marked as dead by the upgrade step. Or indeed
any address where the machine has already been removed from state.