state: only update API host ports if changed

If the API host ports haven't changed, don't
update them. This avoids spamming the transaction log
with unnecessary writes.

Fixes https://bugs.launchpad.net/juju-core/+bug/1345832
state: handle concurrent calls to SetAPIHostPorts
Merge pull request #349 from axw/state-setapihostports-ifchange-1.20

If the API host ports haven't changed, don't

update them. This avoids spamming the transaction log
with unnecessary writes.

(Cherry pick from trunk)

Fixes https://bugs.launchpad.net/juju-core/+bug/1345832