mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
fix(region): set force stop default timeout 30s (#25614)
This commit is contained in:
@@ -259,14 +259,17 @@ func (self *SKVMGuestDriver) GetGuestVncInfo(ctx context.Context, userCred mccli
|
||||
func (self *SKVMGuestDriver) RequestStopOnHost(ctx context.Context, guest *models.SGuest, host *models.SHost, task taskman.ITask, syncStatus bool) error {
|
||||
body := jsonutils.NewDict()
|
||||
params := task.GetParams()
|
||||
timeout, err := params.Int("timeout")
|
||||
if err != nil {
|
||||
timeout = int64(options.Options.DefaultGuestStopTimeout)
|
||||
}
|
||||
isForce, _ := params.Bool("is_force")
|
||||
if isForce {
|
||||
body.Set("is_force", jsonutils.JSONTrue)
|
||||
}
|
||||
timeout, err := params.Int("timeout")
|
||||
if err != nil {
|
||||
timeout = int64(options.Options.DefaultGuestStopTimeout)
|
||||
if isForce {
|
||||
timeout = int64(options.Options.DefaultGuestForceStopTimeout)
|
||||
}
|
||||
}
|
||||
body.Add(jsonutils.NewInt(timeout), "timeout")
|
||||
|
||||
header := self.getTaskRequestHeader(task)
|
||||
|
||||
@@ -1426,13 +1426,14 @@ func (self *SGuest) StartGuestStopTask(ctx context.Context, userCred mcclient.To
|
||||
self.SetStatus(ctx, userCred, api.VM_START_STOP, "")
|
||||
}
|
||||
params := jsonutils.NewDict()
|
||||
timeout := options.Options.DefaultGuestStopTimeout
|
||||
if isForce {
|
||||
timeout = options.Options.DefaultGuestForceStopTimeout
|
||||
params.Add(jsonutils.NewBool(isForce), "is_force")
|
||||
}
|
||||
if timeoutSecs != nil {
|
||||
params.Add(jsonutils.NewInt(int64(*timeoutSecs)), "timeout")
|
||||
} else {
|
||||
timeout := options.Options.DefaultGuestStopTimeout
|
||||
params.Add(jsonutils.NewInt(int64(timeout)), "timeout")
|
||||
}
|
||||
params.Add(jsonutils.NewBool(stopCharging), "stop_charging")
|
||||
|
||||
@@ -98,7 +98,8 @@ type ComputeOptions struct {
|
||||
DefaultDiskDriver string `help:"default disk driver" choices:"scsi|virtio|ide" default:"scsi"`
|
||||
DefaultDiskCacheMode string `help:"default kvm disk cache mode" choices:"writeback|none|writethrough" default:"none"`
|
||||
|
||||
DefaultGuestStopTimeout int `help:"default guest stop timeout" default:"300"`
|
||||
DefaultGuestStopTimeout int `help:"default guest stop timeout" default:"300"`
|
||||
DefaultGuestForceStopTimeout int `help:"default guest force stop timeout" default:"30"`
|
||||
|
||||
SystemAdminQuotaCheck bool `help:"Enable quota check for system admin, default False" default:"false"`
|
||||
CloudaccountHealthStatusCheck bool `help:"Enable cloudaccount health status check, default True" default:"true"`
|
||||
|
||||
Reference in New Issue
Block a user