mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Automatic merge from release/2.3.0 -> release/2.4.0
* commit '4db82c95608cea2856ca7485637af1dd6bba03fc': region: server deploy 和 save-image 操作后自动重启
This commit is contained in:
@@ -277,7 +277,7 @@ func (self *SKVMGuestDriver) GetChangeConfigStatus() ([]string, error) {
|
||||
}
|
||||
|
||||
func (self *SKVMGuestDriver) GetDeployStatus() ([]string, error) {
|
||||
return []string{models.VM_READY}, nil
|
||||
return []string{models.VM_READY, models.VM_RUNNING, models.VM_ADMIN}, nil
|
||||
}
|
||||
|
||||
func (self *SKVMGuestDriver) ValidateResizeDisk(guest *models.SGuest, disk *models.SDisk, storage *models.SStorage) error {
|
||||
|
||||
@@ -98,7 +98,7 @@ func (self *SGuest) PerformSaveImage(ctx context.Context, userCred mcclient.Toke
|
||||
return nil, httperrors.NewInputParameterError("No root image")
|
||||
} else {
|
||||
kwargs := data.(*jsonutils.JSONDict)
|
||||
restart := self.Status == VM_RUNNING
|
||||
restart := (self.Status == VM_RUNNING) || jsonutils.QueryBoolean(data, "auto_start", false)
|
||||
properties := jsonutils.NewDict()
|
||||
if notes, err := data.GetString("notes"); err != nil && len(notes) > 0 {
|
||||
properties.Add(jsonutils.NewString(notes), "notes")
|
||||
@@ -347,7 +347,8 @@ func (self *SGuest) PerformDeploy(ctx context.Context, userCred mcclient.TokenCr
|
||||
}
|
||||
|
||||
if utils.IsInStringArray(self.Status, deployStatus) {
|
||||
if doRestart && self.Status == VM_RUNNING {
|
||||
if (doRestart && self.Status == VM_RUNNING) ||
|
||||
jsonutils.QueryBoolean(kwargs, "auto_start", false) {
|
||||
kwargs.Set("restart", jsonutils.JSONTrue)
|
||||
}
|
||||
err := self.StartGuestDeployTask(ctx, userCred, kwargs, "deploy", "")
|
||||
|
||||
Reference in New Issue
Block a user