@@ -148,15 +148,27 @@ func (self *SGuest) PerformEvent(ctx context.Context, userCred mcclient.TokenCre
148148 }
149149 if event == "GUEST_PANICKED" {
150150 kwargs := jsonutils .NewDict ()
151- kwargs .Set ("reason" , data )
151+ kwargs .Set ("reason" , jsonutils .NewString (event ))
152+ if data .Contains ("screen_dump_info" ) {
153+ screenDumpInfo := api.SGuestScreenDump {}
154+ if err := data .Unmarshal (& screenDumpInfo , "screen_dump_info" ); err != nil {
155+ log .Errorf ("failed unmarshal screen_dump_info %s" , err )
156+ } else {
157+ kwargs .Set ("screen_dump_name" , jsonutils .NewString (screenDumpInfo .S3ObjectName ))
158+ if _ , err := self .SaveGuestScreenDump (ctx , userCred , & screenDumpInfo ); err != nil {
159+ log .Errorf ("SaveGuestScreenDump failed %s" , err )
160+ }
161+ }
162+ }
152163
153- db .OpsLog .LogEvent (self , db .ACT_GUEST_PANICKED , data .String (), userCred )
154- logclient .AddSimpleActionLog (self , logclient .ACT_GUEST_PANICKED , data .String (), userCred , true )
164+ db .OpsLog .LogEvent (self , db .ACT_GUEST_PANICKED , kwargs .String (), userCred )
165+ logclient .AddSimpleActionLog (self , logclient .ACT_GUEST_PANICKED , kwargs .String (), userCred , true )
155166 notifyclient .EventNotify (ctx , userCred , notifyclient.SEventNotifyParam {
156167 Obj : self ,
157168 Action : notifyclient .ActionServerPanicked ,
158169 IsFail : true ,
159170 })
171+
160172 }
161173 return nil , nil
162174}
0 commit comments