From 644f549263a125e8c2fe19ed37b76da6cf2ccd85 Mon Sep 17 00:00:00 2001 From: Qu Xuan Date: Wed, 25 Dec 2019 16:07:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=AF=E6=8C=81=E5=BF=BD=E7=95=A5clou?= =?UTF-8?q?daccount=E5=81=A5=E5=BA=B7=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/compute/models/cloudaccounts.go | 6 ++++++ pkg/compute/options/options.go | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/compute/models/cloudaccounts.go b/pkg/compute/models/cloudaccounts.go index 60135f902e..e3f0e60ae5 100644 --- a/pkg/compute/models/cloudaccounts.go +++ b/pkg/compute/models/cloudaccounts.go @@ -680,6 +680,9 @@ func (self *SCloudaccount) importSubAccount(ctx context.Context, userCred mcclie newCloudprovider.AccessUrl = self.AccessUrl newCloudprovider.Enabled = true newCloudprovider.Status = api.CLOUD_PROVIDER_CONNECTED + if !options.Options.CloudaccountHealthStatusCheck { + self.HealthStatus = api.CLOUD_PROVIDER_HEALTH_NORMAL + } newCloudprovider.HealthStatus = self.HealthStatus newCloudprovider.Name = newName if !self.AutoCreateProject || len(self.ProjectId) > 0 { @@ -1387,6 +1390,9 @@ func (account *SCloudaccount) probeAccountStatus(ctx context.Context, userCred m account.IsOnPremise = factory.IsOnPremise() account.HasObjectStorage = factory.IsSupportObjectStorage() account.Balance = balance + if !options.Options.CloudaccountHealthStatusCheck { + status = api.CLOUD_PROVIDER_HEALTH_NORMAL + } account.HealthStatus = status account.ProbeAt = timeutils.UtcNow() account.Version = version diff --git a/pkg/compute/options/options.go b/pkg/compute/options/options.go index 8f0f97ef88..6802060ae9 100644 --- a/pkg/compute/options/options.go +++ b/pkg/compute/options/options.go @@ -73,7 +73,8 @@ type ComputeOptions struct { DefaultRdsQuota int `default:"10" help:"Common RDS quota per tenant, default 10"` DefaultCacheQuota int `default:"10" help:"Common ElasticCache quota per tenant, default 10"` - SystemAdminQuotaCheck bool `help:"Enable quota check for system admin, default False" default:"false"` + SystemAdminQuotaCheck bool `help:"Enable quota check for system admin, default False" default:"false"` + CloudaccountHealthStatusCheck bool `help:"Enable cloudaccount health status check, default True" default:"true"` BaremetalPreparePackageUrl string `help:"Baremetal online register package"`