From e9da1022b957a3f1f26a0fd8cdf2153e44aa68e7 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Sun, 21 Jun 2020 10:47:00 +0800 Subject: [PATCH] ignore common etcd endpoint not found error --- pkg/compute/service/service.go | 4 ++++ pkg/hostman/host_services.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pkg/compute/service/service.go b/pkg/compute/service/service.go index 836f870830..ac8364ba3e 100644 --- a/pkg/compute/service/service.go +++ b/pkg/compute/service/service.go @@ -43,6 +43,7 @@ import ( _ "yunion.io/x/onecloud/pkg/compute/storagedrivers" _ "yunion.io/x/onecloud/pkg/compute/tasks" "yunion.io/x/onecloud/pkg/controller/autoscaling" + "yunion.io/x/onecloud/pkg/httperrors" _ "yunion.io/x/onecloud/pkg/multicloud/loader" ) @@ -180,6 +181,9 @@ func initDefaultEtcdClient(opts *common_options.DBOptions) error { func initEtcdLockOpts(opts *options.ComputeOptions) error { etcdEndpoint, err := app_common.FetchEtcdServiceInfo() if err != nil { + if errors.Cause(err) == httperrors.ErrNotFound { + return nil + } return errors.Wrap(err, "fetch etcd service info") } if etcdEndpoint != nil { diff --git a/pkg/hostman/host_services.go b/pkg/hostman/host_services.go index d2adcbe879..f2766fb421 100644 --- a/pkg/hostman/host_services.go +++ b/pkg/hostman/host_services.go @@ -43,6 +43,7 @@ import ( "yunion.io/x/onecloud/pkg/hostman/storageman/diskhandlers" "yunion.io/x/onecloud/pkg/hostman/storageman/storagehandler" "yunion.io/x/onecloud/pkg/hostman/system_service" + "yunion.io/x/onecloud/pkg/httperrors" "yunion.io/x/onecloud/pkg/util/procutils" "yunion.io/x/onecloud/pkg/util/sysutils" ) @@ -170,6 +171,9 @@ func (host *SHostService) initHandlers(app *appsrv.Application) { func (host *SHostService) initEtcdConfig() error { etcdEndpoint, err := app_common.FetchEtcdServiceInfo() if err != nil { + if errors.Cause(err) == httperrors.ErrNotFound { + return nil + } return errors.Wrap(err, "fetch etcd service info") } if etcdEndpoint == nil {