Consider the machine when getting filenames.
Add a resource for the API server's machine ID.
Factor out dealing with the API server resources.
The hard-coded machine ID with the value from the API server resource.
Use the proper machine ID when looking for the agent config.
extractResourceValues -> extractResourceValue.
io.Reader -> *os.File.
Add a tag to all the remaining uses of apiserver.ServerConfig.
Merge pull request #1263 from ericsnowcurrently/backups-machine0

Use the proper machine ID in backup and restore.

To accomplish this we add a new API server resource, "machineID", which is pulled from the agent conf.  At that point backups can use that value when creating a new archive.  Once the archive has the correct machine ID, we can use that ID in restore.

Fixes https://bugs.launchpad.net/juju-core/+bug/1398837 (and partially 1389362).

(Review request: http://reviews.vapour.ws/r/577/)
Copy database sessions.
Retry if the session drops.
Move the session copy into NewDBInfo.
Fix a typo.
Use errors.Cause.
Add a TODO comment about the type conversion.
Retry multiple times if we detect dropped connections.
Add replicaset.IsReady and testing helpers.
Ensure that the replicaset is ready.
Do not worry about reconnecting since we wait for HA to come up.
Do not do the HA check during testing.