From e42a33e84368ab41c8a813e1c933c4504a72ee4b Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Thu, 2 Mar 2017 14:45:10 -0800 Subject: [PATCH] etcdmain: log detected machine host after update check Signed-off-by: Gyu-Ho Lee --- etcdmain/etcd.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/etcdmain/etcd.go b/etcdmain/etcd.go index 321e1ce47031..b4220d479fc3 100644 --- a/etcdmain/etcd.go +++ b/etcdmain/etcd.go @@ -85,7 +85,13 @@ func startEtcdOrProxyV2() { GoMaxProcs := runtime.GOMAXPROCS(0) plog.Infof("setting maximum number of CPUs to %d, total number of available CPUs is %d", GoMaxProcs, runtime.NumCPU()) - (&cfg.Config).UpdateDefaultClusterFromName(defaultInitialCluster) + defaultHost, dhErr := (&cfg.Config).UpdateDefaultClusterFromName(defaultInitialCluster) + if defaultHost != "" { + plog.Infof("advertising using detected default host %q", defaultHost) + } + if dhErr != nil { + plog.Noticef("failed to detect default host (%v)", dhErr) + } if cfg.Dir == "" { cfg.Dir = fmt.Sprintf("%v.etcd", cfg.Name) @@ -184,15 +190,6 @@ func startEtcdOrProxyV2() { // startEtcd runs StartEtcd in addition to hooks needed for standalone etcd. func startEtcd(cfg *embed.Config) (<-chan struct{}, <-chan error, error) { - defaultHost, dhErr := cfg.IsDefaultHost() - if defaultHost != "" { - if dhErr == nil { - plog.Infof("advertising using detected default host %q", defaultHost) - } else { - plog.Noticef("failed to detect default host, advertise falling back to %q (%v)", defaultHost, dhErr) - } - } - if cfg.Metrics == "extensive" { grpc_prometheus.EnableHandlingTimeHistogram() }