mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(host): nbd worker count add options (#21094)
This commit is contained in:
@@ -155,6 +155,7 @@ type HostCommonOptions struct {
|
||||
ExecutorConnectTimeoutSeconds int `help:"executor client connection timeout in seconds, default is 30" default:"30"`
|
||||
EnableIsolatedDeviceWhitelist bool `help:"enable isolated device white list" default:"false"`
|
||||
ImageDeployDriver string `help:"Image deploy driver" default:"qemu-kvm" choices:"qemu-kvm|nbd|libguestfs"`
|
||||
DeployConcurrent int `help:"qemu-kvm deploy driver concurrent" default:"5"`
|
||||
}
|
||||
|
||||
type DBOptions struct {
|
||||
|
||||
@@ -67,7 +67,7 @@ var (
|
||||
LAST_USED_PORT = 0
|
||||
LAST_USED_NBD_SERVER_PORT = 0
|
||||
LAST_USED_MIGRATE_PORT = 0
|
||||
NbdWorker = appsrv.NewWorkerManager("nbd_worker", 1, appsrv.DEFAULT_BACKLOG, false)
|
||||
NbdWorker *appsrv.SWorkerManager
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -108,7 +108,10 @@ type SGuestManager struct {
|
||||
pythonPath string
|
||||
}
|
||||
|
||||
func NewGuestManager(host hostutils.IHost, serversPath string) (*SGuestManager, error) {
|
||||
func NewGuestManager(host hostutils.IHost, serversPath string, workerCnt int) (*SGuestManager, error) {
|
||||
// init nbd worker
|
||||
NbdWorker = appsrv.NewWorkerManager("nbd_worker", workerCnt, appsrv.DEFAULT_BACKLOG, false)
|
||||
|
||||
manager := &SGuestManager{}
|
||||
manager.host = host
|
||||
manager.ServersPath = serversPath
|
||||
@@ -1715,9 +1718,9 @@ func Stop() {
|
||||
guestManager.ExitGuestCleanup()
|
||||
}
|
||||
|
||||
func Init(host hostutils.IHost, serversPath string) error {
|
||||
func Init(host hostutils.IHost, serversPath string, workerCnt int) error {
|
||||
if guestManager == nil {
|
||||
manager, err := NewGuestManager(host, serversPath)
|
||||
manager, err := NewGuestManager(host, serversPath, workerCnt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func (host *SHostService) RunService() {
|
||||
|
||||
var guestChan chan struct{}
|
||||
|
||||
if err := guestman.Init(hostInstance, options.HostOptions.ServersPath); err != nil {
|
||||
if err := guestman.Init(hostInstance, options.HostOptions.ServersPath, options.HostOptions.DeployConcurrent); err != nil {
|
||||
log.Fatalf("guest manager init error: %s", err)
|
||||
}
|
||||
guestman.GetGuestManager().InitQemuMaxCpus(
|
||||
|
||||
@@ -45,7 +45,6 @@ type SDeployOptions struct {
|
||||
DeployAction string `help:"local deploy action"`
|
||||
DeployParams string `help:"params for deploy action"`
|
||||
DeployParamsFile string `help:"file store params for deploy action"`
|
||||
DeployConcurrent int `help:"qemu-kvm deploy driver concurrent" default:"5"`
|
||||
}
|
||||
|
||||
var DeployOption SDeployOptions
|
||||
|
||||
Reference in New Issue
Block a user