Skip to content

Commit

Permalink
fix(glance): image stream worker count (#21536)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Nov 7, 2024
1 parent 0b50b21 commit b3c9c85
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/image/models/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ func init() {
}
ImageManager.SetVirtualObject(ImageManager)

imgStreamingWorkerMan = appsrv.NewWorkerManager("image_streaming_worker", 10, 1024, true)
}

func InitImageStreamWorkers() {
imgStreamingWorkerMan = appsrv.NewWorkerManager("image_streaming_worker", options.Options.ImageStreamWorkerCount, 1024, true)
}

/*
Expand Down
2 changes: 2 additions & 0 deletions pkg/image/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ type SImageOptions struct {
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"`

ImageStreamWorkerCount int `help:"Image stream worker count" default:"10"`
}

var (
Expand Down
2 changes: 2 additions & 0 deletions pkg/image/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func StartService() {

common_options.StartOptionManager(opts, opts.ConfigSyncPeriodSeconds, api.SERVICE_TYPE, api.SERVICE_VERSION, options.OnOptionsChange)

models.InitImageStreamWorkers()

if opts.PortV2 > 0 {
log.Infof("Port V2 %d is specified, use v2 port", opts.PortV2)
opts.Port = opts.PortV2
Expand Down

0 comments on commit b3c9c85

Please sign in to comment.