Heartbeat timeout means the period length that indicates heartbeat is
out of service, which is different from heartbeat interval.
So we should use '-peer-heartbeat-interval' instead of
'-peer-heartbeat-timeout' in etcd.
'-peer-heartbeat-timeout' is deprecated but still could be used.
The boot order for peers is -discovery, -peers, log data, forming
new cluster itself.
Special rules:
1. If discovery succeeds, it would find peers specified by discover URL
only.
2. Etcd would fail when meeting bad -discovery, no -peers and log data.
Add TestDiscoveryDownNoBackupPeersWithDataDir as the test.
Lets get a bit more consistent in printing the versions:
```
$ ./bin/etcd -version
etcd version 0.3.0+git
$ ./bin/etcdctl -v
etcdctl version 0.3.0+git
```
Refactor config into its own package. Trying to tease the config from
the server so that all of the control surfaces are exposed in the Server
for easier testing.
for i in github.com/BurntSushi/toml github.com/coreos/go-etcd/etcd github.com/coreos/go-log/log github.com/gorilla/context github.com/rcrowley/go-metrics bitbucket.org/kardianos/osext github.com/coreos/go-systemd/journal github.com/coreos/raft code.google.com/p/goprotobuf/proto ; do goven -copy -rewrite $i; done
In d0c4916fe9b2afaa273a2a7bc9782321a866ab9f the TLS CA Certificate
verification broke.
This was bisected using the following basic test:
```
./bin/etcd -f -name machine0 -data-dir machine0 -ca-file=/tmp/ca/ca.crt -cert-file=/tmp/ca/server.crt -key-file=/tmp/ca/server.key.insecure
```
And in another window doing
```
curl --key /tmp/ca/server2.key.insecure --cert /tmp/ca/server2.crt -k -L https://127.0.0.1:4001/v2/keys/foo -XPUT -d value=bar -v
```
Before merging this PR there are a few things that need to be fixed up:
1) Tests for client certs both positive and negative
2) Refactor (or at least documentation of) the TLSConfig types
* server/cors.go renamed to http/cors.go
* all CORS code removed from Server and PeerServer
* Server and PeerServer fulfill http.Handler, now passed to http.Serve
* non-HTTP code in PeerServer.Serve moved to PeerServer.Start
* -trace flag controls whether or not to enable metrics-gathering
and the /debug/* HTTP endpoints
* -graphite-host flag controls where metrics should be sent
* timer.ae.handle metric tracks execution time of AppendEntriesRequest
When a server name or a data directory were not provided, the
reset functionality would fail to clear out config files from
the appropriate place. This calcualtes the default server name
and data directory before reset is called.
- Only generate the name from a hostname if the data dir is not
specified and the name is not specified
- Only guess the data dir from Name if the data dir wasn't already
specified
In the refactor of the configuration and flags I think that we
accidently placed this logic twice. The side effect is that we always
ended up with a `.etcd` directory.