mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-29 17:58:36 +08:00
fix(region): disk reset webhook (#23326)
This commit is contained in:
@@ -45,6 +45,7 @@ var (
|
||||
ActionCreate = api.ActionCreate
|
||||
ActionDelete = api.ActionDelete
|
||||
ActionUpdate = api.ActionUpdate
|
||||
ActionReset = api.ActionReset
|
||||
ActionRebuildRoot = api.ActionRebuildRoot
|
||||
ActionResetPassword = api.ActionResetPassword
|
||||
ActionChangeConfig = api.ActionChangeConfig
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db/taskman"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/notifyclient"
|
||||
"yunion.io/x/onecloud/pkg/compute/models"
|
||||
"yunion.io/x/onecloud/pkg/util/logclient"
|
||||
)
|
||||
@@ -65,6 +66,10 @@ func (self *DiskResetTask) TaskFailed(ctx context.Context, disk *models.SDisk, r
|
||||
}
|
||||
|
||||
func (self *DiskResetTask) TaskCompleted(ctx context.Context, disk *models.SDisk, data *jsonutils.JSONDict) {
|
||||
notifyclient.EventNotify(ctx, self.GetUserCred(), notifyclient.SEventNotifyParam{
|
||||
Obj: disk,
|
||||
Action: notifyclient.ActionReset,
|
||||
})
|
||||
guests := disk.GetGuests()
|
||||
if jsonutils.QueryBoolean(self.Params, "auto_start", false) {
|
||||
if len(guests) == 1 {
|
||||
|
||||
@@ -504,6 +504,7 @@ func initTopicElement(name string, t *STopic) {
|
||||
t.addResources(
|
||||
api.TOPIC_RESOURCE_SERVER,
|
||||
api.TOPIC_RESOURCE_CLOUDPHONE,
|
||||
api.TOPIC_RESOURCE_DISK,
|
||||
)
|
||||
t.addAction(
|
||||
api.ActionStart,
|
||||
|
||||
Reference in New Issue
Block a user