state/apiserver: move api/params to apiserver/params

This PR moves api/params to apiserver/params. The justification is the params package defines the form of the api messages that the server will accept, not the form that the client will provide.

This move makes it clear that the parameters belong to the apiserver, not a Go implementation of the api client.
Merge branch 'master' of https://github.com/juju/juju into 190-move-state-api-params-to-state-apiserver-params
Update State.AddUser to validate username

Use names.IsValidUserName to validate the user and creator string
passed in to State.AddUser.
gofmt
Merge pull request #653 from davecheney/190-move-state-api-params-to-state-apiserver-params

state/apiserver: move api/params to apiserver/params

This PR moves `api/params` to `apiserver/params`. The justification is the `params` package defines the form of the api messages that the server will accept, not the form that the client will provide.

This move makes it clear that the parameters belong to the `apiserver`, not a Go implementation of the api client.
Move state/api and state/apiserver to top level

This is a follow up to #653 that finishes the general code migration.
gofmt
Merge pull request #655 from davecheney/191-move-state-api-apiserver-to-top-level

Move state/api and state/apiserver to top level

This is a follow up to #653 that finishes the general code migration.
Merge pull request #650 from wallyworld/machine-doc-insert-order

Ensure machine doc is inserted last after any related docs

Maybe fixes: https://bugs.launchpad.net/juju-core/+bug/1354027

With debug turned on, it could be seen that the provisioner task was being notified of containers added to a host, which the provisioner then started to process. However, at this time, the machine records were not necessarily all written to the database yet. It turned out that for one container, its status document was not yet written, so the provisioner saw an error and ignored the container forever. A couple of seconds after this happened, the status record was written.

The txn ops to add a machine and its associated docs are re-ordered such that the main machine doc is created last.
Merge pull request #654 from waigani/AddUser-IsValidUserName

Update State.AddUser to validate username

Use names.IsValidUserName to validate the user string
passed in to State.AddUser.
Remove environs/tools.FindInstanceTools
Merge pull request #656 from wallyworld/machine-doc-insert-order-trunk

Merge pull request #650 from wallyworld/machine-doc-insert-order

Ensure machine doc is inserted last after any related docs

Maybe fixes: https://bugs.launchpad.net/juju-core/+bug/1354027

With debug turned on, it could be seen that the provisioner task was being notified of containers added to a host, which the provisioner then started to process. However, at this time, the machine records were not necessarily all written to the database yet. It turned out that for one container, its status document was not yet written, so the provisioner saw an error and ignored the container forever. A couple of seconds after this happened, the status record was written.

The txn ops to add a machine and its associated docs are re-ordered such that the main machine doc is created last.
Merge pull request #649 from axw/remove-environs-tools-findinstancetools

Remove environs/tools.FindInstanceTools

Reduce surface area of environs/tools as we reduce reliance on it. Eventually the simplestreams parts should be relocated and become client-side, import-only. Several users do not need to be using FindInstanceTools (use FindExactTools or just FindTools instead).
Fixed logging prefixes after moving state/api -> api/ and state/apiserver -> apiserver/
Merge pull request #659 from dimitern/fix-logging-after-api-move

Fixed logging prefixes after moving state/api -> api/ and state/apiserver -> apiserver/

After https://github.com/juju/juju/pull/655 got merged, I noticed some loggers are still using "state.api.*" and "state.apiserver.*", so this fixes these to drop the "state." prefix.

Also, added more logging to juju/testing/conn.go and state.Close() hoping to provide more context for fixing CI bugs like http://pad.lv/1348477.