1717
1818package org .apache .cloudstack .outofbandmanagement ;
1919
20+ import com .cloud .event .ActionEventUtils ;
21+ import com .cloud .event .EventTypes ;
22+ import com .cloud .event .EventVO ;
2023import com .cloud .host .Host ;
24+ import org .apache .cloudstack .context .CallContext ;
2125import org .apache .log4j .Logger ;
2226
2327public class PowerOperationTask implements Runnable {
@@ -43,8 +47,14 @@ public void run() {
4347 try {
4448 service .executePowerOperation (host , powerOperation , null );
4549 } catch (Exception e ) {
46- LOG .warn (String .format ("Out-of-band management background task operation=%s for host id=%d failed with: %s" ,
47- powerOperation .name (), host .getId (), e .getMessage ()));
50+ LOG .warn (String .format ("Out-of-band management background task operation=%s for host %s failed with: %s" ,
51+ powerOperation .name (), host .getName (), e .getMessage ()));
52+
53+ String eventMessage = String
54+ .format ("Error while issuing out-of-band management action %s for host: %s" , powerOperation .name (), host .getName ());
55+
56+ ActionEventUtils .onCreatedActionEvent (CallContext .current ().getCallingUserId (), CallContext .current ().getCallingAccountId (), EventVO .LEVEL_WARN ,
57+ EventTypes .EVENT_HOST_OUTOFBAND_MANAGEMENT_ACTION , true , eventMessage );
4858 }
4959 }
5060}
0 commit comments