From 00069a6070b627af7699e6b92faa29471520a99f Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Wed, 2 Jun 2021 10:44:16 +0800 Subject: [PATCH] fix(glance): add option of s3 image status check --- pkg/image/models/storage.go | 3 ++- pkg/image/options/options.go | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/image/models/storage.go b/pkg/image/models/storage.go index b40d7f966f..fa69095d7c 100644 --- a/pkg/image/models/storage.go +++ b/pkg/image/models/storage.go @@ -24,6 +24,7 @@ import ( "yunion.io/x/onecloud/pkg/apis/image" "yunion.io/x/onecloud/pkg/image/drivers/s3" + "yunion.io/x/onecloud/pkg/image/options" "yunion.io/x/onecloud/pkg/util/procutils" ) @@ -159,7 +160,7 @@ func (s *S3Storage) GetImage(imagePath string) (int64, io.ReadCloser, error) { } func (s *S3Storage) IsCheckStatusEnabled() bool { - return false + return options.Options.S3CheckImageStatus } func (s *S3Storage) RemoveImage(fileName string) error { diff --git a/pkg/image/options/options.go b/pkg/image/options/options.go index 280645abb2..24d9c16d3b 100644 --- a/pkg/image/options/options.go +++ b/pkg/image/options/options.go @@ -44,12 +44,13 @@ type SImageOptions struct { StorageDriver string `help:"image backend storage" default:"local" choices:"s3|local"` - S3AccessKey string `help:"s3 access key"` - S3SecretKey string `help:"s3 secret key"` - S3Endpoint string `help:"s3 endpoint"` - S3UseSSL bool `help:"s3 access use ssl"` - S3BucketName string `help:"s3 bucket name" default:"onecloud-images"` - S3MountPoint string `help:"s3fs mount point" default:"/opt/cloud/workspace/data/glance/s3images"` + S3AccessKey string `help:"s3 access key"` + S3SecretKey string `help:"s3 secret key"` + S3Endpoint string `help:"s3 endpoint"` + S3UseSSL bool `help:"s3 access use ssl"` + S3BucketName string `help:"s3 bucket name" default:"onecloud-images"` + S3MountPoint string `help:"s3fs mount point" default:"/opt/cloud/workspace/data/glance/s3images"` + S3CheckImageStatus bool `help:"Enable s3 check image status"` } var (