Skip to content

Commit

Permalink
fix host init without etcd
Browse files Browse the repository at this point in the history
  • Loading branch information
wanyaoqi committed Apr 30, 2020
1 parent db2d02f commit 9652c97
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/compute/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ type HostDetails struct {
CanPrepare bool `json:"can_prepare"`
PrepareFailReason string `json:"prepare_fail_reason"`
// 允许开启宿主机健康检查
EnableHealthCheck bool `json:"enable_health_check"`
AllowHealthCheck bool `json:"allow_health_check"`

// 标签
Metadata map[string]string `json:"metadata"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/compute/models/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2607,7 +2607,7 @@ func (self *SHost) getMoreDetails(ctx context.Context, out api.HostDetails, show
}

if self.EnableHealthCheck && hostHealthChecker != nil {
out.EnableHealthCheck = true
out.AllowHealthCheck = true
}
return out
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/hostman/host_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ func (host *SHostService) initEtcdConfig() error {
if err != nil {
return errors.Wrap(err, "fetch etcd service info")
}
if etcdEndpoint == nil {
return nil
}
if len(options.HostOptions.EtcdEndpoints) == 0 {
options.HostOptions.EtcdEndpoints = []string{etcdEndpoint.Url}
if len(etcdEndpoint.CertId) > 0 {
Expand Down

0 comments on commit 9652c97

Please sign in to comment.