cmd/jujud: restrict API logins during upgrades

Use the recently introduced API login validation functionality to only allow client and local machine agent logins while upgrade steps are running. The goal is minimise database activity during upgrades, specifically for schema migrations.

As well as the unit tests, this change has been heavily tested manually.

One of the coming cards adds the synchronisation between state servers during upgrades. The current plan (which I will be reviewing on Tuesday following further feedback) is for non-master state servers to wait for the master to complete it's upgrade steps (which may include schema migrations) before they start theirs. This means that all state servers are in "upgrade mode" - accepting limited login requests - until after the schema migrations have been applied to the DB.

There's still a few details and failure modes which I need to work through on Tuesday. I'll let you know once the doc has been updated so you can have another pass.