From 37a479075b581907017ac41050c583db656cb12e Mon Sep 17 00:00:00 2001 From: wanyaoqi Date: Tue, 2 Feb 2021 17:52:45 +0800 Subject: [PATCH] fix(region): add option auto reconcile backup servers --- pkg/compute/options/options.go | 3 ++- pkg/compute/service/service.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/compute/options/options.go b/pkg/compute/options/options.go index 6f69e9d454..e247b551aa 100644 --- a/pkg/compute/options/options.go +++ b/pkg/compute/options/options.go @@ -153,7 +153,8 @@ type ComputeOptions struct { SyncStorageCapacityUsedIntervalMinutes int `help:"interval sync storage capacity used" default:"20"` LockStorageFromCachedimage bool `help:"must use storage in where selected cachedimage when creating vm"` - SyncExtDiskSnapshotIntervalMinutes int `help:"sync snapshot for external disk" default:"20"` + SyncExtDiskSnapshotIntervalMinutes int `help:"sync snapshot for external disk" default:"20"` + AutoReconcileBackupServers bool `help:"auto reconcile backup servers" default:"false"` SCapabilityOptions SASControllerOptions diff --git a/pkg/compute/service/service.go b/pkg/compute/service/service.go index 51e56a1234..08034fee1a 100644 --- a/pkg/compute/service/service.go +++ b/pkg/compute/service/service.go @@ -139,7 +139,9 @@ func StartService() { cron.AddJobAtIntervalsWithStartRun("CalculateInfrasQuotaUsages", time.Duration(opts.CalculateQuotaUsageIntervalSeconds)*time.Second, models.InfrasQuotaManager.CalculateQuotaUsages, true) cron.AddJobAtIntervalsWithStartRun("AutoSyncCloudaccountTask", time.Duration(opts.CloudAutoSyncIntervalSeconds)*time.Second, models.CloudaccountManager.AutoSyncCloudaccountTask, true) - cron.AddJobAtIntervalsWithStartRun("ReconcileBackupGuests", time.Duration(opts.ReconcileGuestBackupIntervalSeconds)*time.Second, models.GuestManager.ReconcileBackupGuests, true) + if opts.AutoReconcileBackupServers { + cron.AddJobAtIntervalsWithStartRun("ReconcileBackupGuests", time.Duration(opts.ReconcileGuestBackupIntervalSeconds)*time.Second, models.GuestManager.ReconcileBackupGuests, true) + } cron.AddJobAtIntervalsWithStartRun("SyncCapacityUsedForEsxiStorage", time.Duration(opts.SyncStorageCapacityUsedIntervalMinutes)*time.Minute, models.StorageManager.SyncCapacityUsedForEsxiStorage, true)