From 23a4d6794462195bb8dc68dd2e6d56b71288210a Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Fri, 23 Dec 2022 19:23:02 +0800 Subject: [PATCH] fix: guests short desc add status (#15612) Co-authored-by: Qiu Jian --- pkg/compute/models/guests.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/compute/models/guests.go b/pkg/compute/models/guests.go index 98e22ee345..2c64d830c6 100644 --- a/pkg/compute/models/guests.go +++ b/pkg/compute/models/guests.go @@ -3045,6 +3045,10 @@ func (manager *SGuestManager) newCloudVM(ctx context.Context, userCred mcclient. db.OpsLog.LogEvent(&guest, db.ACT_CREATE, guest.GetShortDesc(ctx), userCred) + if guest.Status == api.VM_RUNNING { + db.OpsLog.LogEvent(&guest, db.ACT_START, guest.GetShortDesc(ctx), userCred) + } + notifyclient.EventNotify(ctx, userCred, notifyclient.SEventNotifyParam{ Obj: &guest, Action: notifyclient.ActionSyncCreate, @@ -4999,6 +5003,8 @@ func (self *SGuest) GetShortDesc(ctx context.Context) *jsonutils.JSONDict { desc.Set("mem", jsonutils.NewInt(int64(self.VmemSize))) desc.Set("cpu", jsonutils.NewInt(int64(self.VcpuCount))) + desc.Set("status", jsonutils.NewString(self.Status)) + address := jsonutils.NewString(strings.Join(self.GetRealIPs(), ",")) desc.Set("ip_addr", address)