Merge branch 'master' into copy-session
Fix login deadlock
Merge pull request #381 from wallyworld/login-test-deadlock

Fix login deadlock

One of the login tests could deadlock. Change the test to start all N+1 attempts together, rather than N and then 1. 

Fixes lp:1347939
Merge pull request #384 from wallyworld/copy-session

Copy mongo sessions

Fixes lp:1307434 (hopefully)

Each time a mgo interaction is required, the session is copied to try and ensure the underlying socket is not stale.
Composable API handler, support v1 and v2 login.
Use fail return value for v1 admin Login.
Use function type instead of interface/struct.
WIP on admin api dispatch, using rpc server properly.
More fixes from jam's review & misc.

Move loggedIn mutex to admin object.
s/APIHandler/apiHandler/
Remove commented out srvRoot, no longer needed to test registry.
Remove ApiFilter.
Move UpgradingRoot to its own file.
Further cleanup and fixes.

Not exposing API types & constructors.
Fix refactored roots to implement rpc.Killer.
Simplify API handler setup in Server.
Add Admin v2 API login request & result.
Added login v2 API.