mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: glance always init s3 client (#22129)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -80,3 +80,7 @@ func OnOptionsChange(oldO, newO interface{}) bool {
|
||||
|
||||
return changed
|
||||
}
|
||||
|
||||
func (opt SImageOptions) HasValidS3Options() bool {
|
||||
return len(opt.S3Endpoint) > 0 && len(opt.S3AccessKey) > 0 && len(opt.S3SecretKey) > 0 && len(opt.S3BucketName) > 0
|
||||
}
|
||||
|
||||
@@ -139,12 +139,13 @@ func StartService() {
|
||||
deployclient.Init(options.Options.DeployServerSocketPath)
|
||||
}
|
||||
|
||||
if options.Options.StorageDriver == api.IMAGE_STORAGE_DRIVER_S3 {
|
||||
go initS3()
|
||||
} else {
|
||||
// Check the images after everything is ready
|
||||
go models.CheckImages()
|
||||
}
|
||||
go func() {
|
||||
if options.Options.HasValidS3Options() {
|
||||
initS3()
|
||||
}
|
||||
// check image after s3 mounted
|
||||
models.CheckImages()
|
||||
}()
|
||||
|
||||
if !opts.IsSlaveNode {
|
||||
cachesync.StartTenantCacheSync(opts.TenantCacheExpireSeconds)
|
||||
@@ -253,7 +254,4 @@ func initS3() {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// check image after s3 mounted
|
||||
models.CheckImages()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user