Comment 2 for bug 1454043

Revision history for this message
John A Meinel (jameinel) wrote : Re: Machine.SetAddresses should not generate transactions for noop changes

So looking at: https://github.com/juju/juju/blob/juju-1.20.11/worker/instancepoller/updater.go#L264 it looks like instance poller is trying to not call SetAddresses if the addresses haven't changed.

However the bug appears to be that Machine.Addresses() is returning the union of cloud addresses and machine addresses, while SetAddresses is only updating the former.
https://github.com/juju/juju/blob/juju-1.20.11/state/machine.go#L940

Thus every loop on the instance poller is seeing that the addresses don't exactly match, so tries to force the update, which then does nothing because the cloud side of the address list already matches.

The big problem is that SetAddresses() and Addresses() do not round trip data, which breaks developer's models of how this works.

We could potentially rename the functions SetCloudAddresses (vs SetMachineAddresses), and Addresses() continues to return all addresses but we add a CloudAddresses() (ProviderAddresses?) function to retrieve just the values we are about to set.