Add restoring root

Add restiring root and refator prepare/finish restore in machine.go
Add force reconfig of peergrouper

When restoring sometimes we need to re-set peergrouper
even if there is a configuration in place.
Added tests for initiatemongoserver

Added tests for initiatemongoserver, formerly known
as MaybeInitiateMongoServer but now supporting a force
parmeter.
I also added an error that is returned when a replicaset
is found in order to add more transparency.
Improved comments and tests for restoring root
Go 1.4 version of `go vet` workaround

  In go1.4 `go vet` incorrectly chokes on the call to
  `logger.Logf(loggo.INFO, fmt, args...)` because the `loggo.INFO` is an
  `iota` not an expected string.

  The error message was:
    `audit/audit.go:30: constant 3 not a string in call to Logf`
  which was confusing, but the `iota` value of `loggo.INFO` is `3`

  This fix sticks to the intent of the `audit.Audit` func, but uses
  `logger.LogCallf` which both bypasses the `go vet` check, and reduces
  one extra method call because `Logf` was previously calling `LogCallf`
  in turn.
Fixed lp:1397376 - api-endpoints behaves as expected
Merge pull request #1297 from dimitern/lp-1397376-public-ips-before-hostnames

Fixed lp:1397376 - api-endpoints behaves as expected

This fixes http://pad.lv/1397376/ by changing how API
server addresses are handled by the CLI/API clients.

Major changes:
 * cmd/juju: api-endpoints - added help text, added --all argument,
 vastly improved tests.
 * network.SortAddresses and network.SortHostPorts changed to apply
 consistent ordering with regards to scope and prefer-ipv6 flag);
 * network.ResolveOrDropHostnames introduced;
 * network package refactored to split relevent entities in their own files/suites;
 * dropped obsolete stuff like most of what's related to network.Port.
 * cmd/juju: bootstrap command - endpoints caching post-bootstrap fixed;
 * juju/api: changed the way API endpoints are cached in the .jenv file.
 * environs/configstore: added APIEndpoint.Hostnames - optional list
 of cached API hostnames/IPs (before resolving), so DNS resolution
 won't be needed if hostnames haven't changed.
 * Added *lots* of extra tests for all changes.

What's changed? Before caching the API endpoints for use by the CLI (either just
 after bootstrap or with api-endpoints --refresh):
 - All known endpoints are sorted in the following order:
 -- public addresses
 -- hostnames (only localhost as the others are resolved, see below)
 -- cloud-local addresses
 -- link-local addresses (which are then filtered out as unusable)
 -- machine-local addresses
 - Then any hostnames, except localhost (because of the local provider
 and also dummy provider to simplify testing), are resolved using the
 local resolver and (if successful) inserted in the same order in the
 list of endpoints. Unresolvable hostnames are dropped. This means the
 .jenv file won't contain any hostnames (except for maybe localhost), as
 this seems to be the expected behavior - scripts prefer IPs, not hosts.
 - Any duplicates are removed.
 - prefer-ipv6 flag is respected (i.e. when true IPv6 addresses of the
 same scope come before IPv4 ones).
 - The last endpoint used to successfully connect to the API server is
 inserted at the top of the list.

Minor changes:
 * network.Address, HostPort, Port, PortRange now all have String() and
 GoString() methods; tests improved.
 * envtesting.PatchAttemptStrategies() changed to include the (now exported)
 AddressesRefreshAttempt used while waiting for bootstrap instance addresses.
 * A few changes to log messages to fix typos or improve
 readability (easier to test/debug some deeply nested operations).

RB link: http://reviews.vapour.ws/r/611/
cmd/juju: don't use JobManageNetworking with servers that don't support it

This fixes LP #1402826.
Merge pull request #1319 from mjs/1402826-jobmanagenetworking-compat

cmd/juju: don't use JobManageNetworking with servers that don't support it

This fixes LP #1402826.

(Review request: http://reviews.vapour.ws/r/638/)
Merge pull request #1305 from perrito666/restore_01_restoring_root

Add restoring root

Add restoring root and refator prepare/finish restore in machine.go

(Review request: http://reviews.vapour.ws/r/619/)
Merge pull request #1314 from johnweldon/go-vet-1.4-workaround

Workaround for go vet error with current version of go vet

  In go1.4 `go vet` incorrectly chokes on the call to
  `logger.Logf(loggo.INFO, fmt, args...)` because the `loggo.INFO` is an
  `iota` not an expected string.

  The error message was:
    `audit/audit.go:30: constant 3 not a string in call to Logf`
  which was confusing, but the `iota` value of `loggo.INFO` is `3`

  This fix sticks to the intent of the `audit.Audit` func, but uses
  `logger.LogCallf` which both bypasses the `go vet` check, and reduces
  one extra method call because `Logf` was previously calling `LogCallf`
  in turn.

(Review request: http://reviews.vapour.ws/r/630/)
Merge pull request #1281 from voidspace/subnet-picknewaddress

Subnet PickNewAddress

A new subnet method for picking a new address for allocating. It randomly picks an unused address between the low and high allocatable bounds of the subnet.

(Review request: http://reviews.vapour.ws/r/596/)
Merge pull request #1306 from perrito666/restore_02_add_peergrouper_force_initiate

Add force reconfig of peergrouper

When restoring sometimes we need to re-set peergrouper
even if there is a configuration in place.

(Review request: http://reviews.vapour.ws/r/620/)
Merge branch 'master' into ec2-subnets