mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
Merge pull request #2528 from ioito/hotfix/qx-managed-guest-rebuild-root-password
fix: deploy action not sync guest status in subtask
This commit is contained in:
@@ -313,12 +313,3 @@ func (self *SBaseGuestDriver) GetGuestSecgroupVpcid(guest *models.SGuest) (strin
|
||||
}
|
||||
return vpcId, nil
|
||||
}
|
||||
|
||||
func (self *SBaseGuestDriver) OnGuestDeployTaskComplete(ctx context.Context, guest *models.SGuest, task taskman.ITask) error {
|
||||
if jsonutils.QueryBoolean(task.GetParams(), "restart", false) {
|
||||
task.SetStage("OnDeployStartGuestComplete", nil)
|
||||
return guest.StartGueststartTask(ctx, task.GetUserCred(), nil, task.GetTaskId())
|
||||
}
|
||||
task.SetStage("OnDeployGuestSyncstatusComplete", nil)
|
||||
return guest.StartSyncstatus(ctx, task.GetUserCred(), task.GetTaskId())
|
||||
}
|
||||
|
||||
@@ -143,12 +143,6 @@ func (self *SContainerDriver) RequestUndeployGuestOnHost(ctx context.Context, gu
|
||||
return err
|
||||
}
|
||||
|
||||
func (self *SContainerDriver) OnGuestDeployTaskComplete(ctx context.Context, guest *models.SGuest, task taskman.ITask) error {
|
||||
guest.SetStatus(task.GetUserCred(), api.VM_RUNNING, "on deploy complete")
|
||||
task.SetStageComplete(ctx, nil)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SContainerDriver) GetJsonDescAtHost(ctx context.Context, userCred mcclient.TokenCredential, guest *models.SGuest, host *models.SHost) jsonutils.JSONObject {
|
||||
return guest.GetJsonDescAtHypervisor(ctx, host)
|
||||
}
|
||||
|
||||
@@ -96,8 +96,6 @@ type IGuestDriver interface {
|
||||
|
||||
OnGuestDeployTaskDataReceived(ctx context.Context, guest *SGuest, task taskman.ITask, data jsonutils.JSONObject) error
|
||||
|
||||
OnGuestDeployTaskComplete(ctx context.Context, guest *SGuest, task taskman.ITask) error
|
||||
|
||||
StartGuestSyncstatusTask(guest *SGuest, ctx context.Context, userCred mcclient.TokenCredential, parentTaskId string) error
|
||||
|
||||
RequestSyncConfigOnHost(ctx context.Context, guest *SGuest, host *SHost, task taskman.ITask) error
|
||||
|
||||
@@ -108,7 +108,6 @@ func (self *GuestDeployTask) OnDeployGuestComplete(ctx context.Context, obj db.I
|
||||
log.Infof("on_guest_deploy_task_data_received %s", data)
|
||||
guest := obj.(*models.SGuest)
|
||||
guest.GetDriver().OnGuestDeployTaskDataReceived(ctx, guest, self, data)
|
||||
guest.GetDriver().OnGuestDeployTaskComplete(ctx, guest, self)
|
||||
action, _ := self.Params.GetString("deploy_action")
|
||||
keypair, _ := self.Params.GetString("keypair")
|
||||
reset_password := jsonutils.QueryBoolean(self.Params, "reset_password", false)
|
||||
@@ -133,6 +132,19 @@ func (self *GuestDeployTask) OnDeployGuestComplete(ctx context.Context, obj db.I
|
||||
// 如果 deploy 有其他事件,统一记在这里。
|
||||
logclient.AddActionLogWithStartable(self, guest, "misc部署", "", self.UserCred, true)
|
||||
}
|
||||
|
||||
if self.HasParentTask() {
|
||||
self.SetStageComplete(ctx, nil)
|
||||
return
|
||||
}
|
||||
|
||||
if jsonutils.QueryBoolean(self.GetParams(), "restart", false) {
|
||||
self.SetStage("OnDeployStartGuestComplete", nil)
|
||||
guest.StartGueststartTask(ctx, self.GetUserCred(), nil, self.GetTaskId())
|
||||
} else {
|
||||
self.SetStage("OnDeployGuestSyncstatusComplete", nil)
|
||||
guest.StartSyncstatus(ctx, self.GetUserCred(), self.GetTaskId())
|
||||
}
|
||||
}
|
||||
|
||||
func (self *GuestDeployTask) OnDeployGuestCompleteFailed(ctx context.Context, obj db.IStandaloneModel, data jsonutils.JSONObject) {
|
||||
|
||||
Reference in New Issue
Block a user