fix(region): disk reset webhook (#23326)

This commit is contained in:
屈轩
2025-09-18 15:08:21 +08:00
committed by GitHub
parent f8001de546
commit 38d1d0f766
3 changed files with 7 additions and 0 deletions
+1
View File
@@ -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 {
+1
View File
@@ -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,