Merge pull request #7873 from rainzm/automated-cherry-pick-of-#7870-upstream-release-3.2

Automated cherry pick of #7870: fix(esxiagent): add HostDelayTaskWorkerCount
This commit is contained in:
Zexi Li
2020-09-11 20:55:47 +08:00
committed by GitHub
4 changed files with 20 additions and 14 deletions
-1
View File
@@ -133,7 +133,6 @@ func Start(app *appsrv.Application) error {
}
func (agent *SEsxiAgent) AddImageCacheHandler(prefix string, app *appsrv.Application) {
hostutils.InitWorkerManager()
app.AddHandler("POST",
fmt.Sprintf("%s/disks/image_cache", prefix),
auth.Authenticate(func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
+13 -12
View File
@@ -19,18 +19,19 @@ import common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
type EsxiOptions struct {
common_options.CommonOptions
ListenInterface string `help:"Master address of host server" default:"br0"`
ListenAddress string `help:"Host serve IP address to select when multiple address bind to ListenInterface"`
EsxiAgentPath string `default:"/opt/cloud/workspace/esxi_agent" help:"Path for esxi agent configuration files"`
ImageCachePath string `help:"Path for storing image caches"`
ImageCacheLimit int `help:"Maximal storage space for image caching, in GB" default:"20"`
AgentTempPath string `help:"Path for ESXI Agent"`
AgentTempLimit int `help:"Maximal storage space for ESXi agent, in GB" default:"20"`
LinuxDefaultRootUser bool `help:"Default account for Linux system is root" default:"false"`
WindowsDefaultAdminUser bool `help:"Default account for Windows system is Administrator" default:"true"`
DefaultImageSaveFormat string `help:"Default image save format, default is vmdk, canbe qcow2" default:"vmdk"`
Zone string `help:"Zone where the agent locates"`
DeployServerSocketPath string `help:"Deploy server listen socket path" default:"/var/run/deploy.sock"`
ListenInterface string `help:"Master address of host server" default:"br0"`
ListenAddress string `help:"Host serve IP address to select when multiple address bind to ListenInterface"`
EsxiAgentPath string `default:"/opt/cloud/workspace/esxi_agent" help:"Path for esxi agent configuration files"`
ImageCachePath string `help:"Path for storing image caches"`
ImageCacheLimit int `help:"Maximal storage space for image caching, in GB" default:"20"`
AgentTempPath string `help:"Path for ESXI Agent"`
AgentTempLimit int `help:"Maximal storage space for ESXi agent, in GB" default:"20"`
LinuxDefaultRootUser bool `help:"Default account for Linux system is root" default:"false"`
WindowsDefaultAdminUser bool `help:"Default account for Windows system is Administrator" default:"true"`
DefaultImageSaveFormat string `help:"Default image save format, default is vmdk, canbe qcow2" default:"vmdk"`
Zone string `help:"Zone where the agent locates"`
DeployServerSocketPath string `help:"Deploy server listen socket path" default:"/var/run/deploy.sock"`
HostDelayTaskWorkerCount int `default:"8" help:"Host delay worker thread count, default is 8"`
}
var (
+2
View File
@@ -30,6 +30,7 @@ import (
"yunion.io/x/onecloud/pkg/esxi/options"
"yunion.io/x/onecloud/pkg/hostman/guestfs/fsdriver"
"yunion.io/x/onecloud/pkg/hostman/hostdeployer/deployclient"
"yunion.io/x/onecloud/pkg/hostman/hostutils"
)
type SExsiAgentService struct {
@@ -70,6 +71,7 @@ func (s *SExsiAgentService) StartService() {
fsdriver.Init(nil)
deployclient.Init(options.Options.DeployServerSocketPath)
hostutils.InitWorkerManagerWithCount(options.Options.HostDelayTaskWorkerCount)
app := app_common.InitApp(&options.Options.BaseOptions, false)
handler.InitHandlers(app)
+5 -1
View File
@@ -189,7 +189,11 @@ func DelayTaskWithWorker(
}
func InitWorkerManager() {
wm = workmanager.NewWorkManger(TaskFailed, TaskComplete, options.HostOptions.DefaultRequestWorkerCount)
InitWorkerManagerWithCount(options.HostOptions.DefaultRequestWorkerCount)
}
func InitWorkerManagerWithCount(count int) {
wm = workmanager.NewWorkManger(TaskFailed, TaskComplete, count)
}
func InitK8sWorkerManager() {