@dimitern If you want to rely solely on what information the api can provide, I think a good approach would be as follows:
1. deploy service and juju creates instance with 1 interface attached
2. juju gets address given to that interface as allocated by Nova and uses this as unit address
3. juju gets port-id of that interface and remembers it
4. if address of the interface remembered in (3) changes, the unit address will change accordingly
This should give us the behaviour we want and be sufficiently deterministic and persistent assuming that the primary interface (port-id) never changes.
@dimitern If you want to rely solely on what information the api can provide, I think a good approach would be as follows:
1. deploy service and juju creates instance with 1 interface attached
2. juju gets address given to that interface as allocated by Nova and uses this as unit address
3. juju gets port-id of that interface and remembers it
4. if address of the interface remembered in (3) changes, the unit address will change accordingly
This should give us the behaviour we want and be sufficiently deterministic and persistent assuming that the primary interface (port-id) never changes.