Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

package org.apache.cloudstack.outofbandmanagement;

import com.cloud.event.ActionEventUtils;
import com.cloud.event.EventTypes;
import com.cloud.event.EventVO;
import com.cloud.host.Host;
import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;

public class PowerOperationTask implements Runnable {
Expand All @@ -43,8 +47,14 @@ public void run() {
try {
service.executePowerOperation(host, powerOperation, null);
} catch (Exception e) {
LOG.warn(String.format("Out-of-band management background task operation=%s for host id=%d failed with: %s",
powerOperation.name(), host.getId(), e.getMessage()));
LOG.warn(String.format("Out-of-band management background task operation=%s for host %s failed with: %s",
powerOperation.name(), host.getName(), e.getMessage()));

String eventMessage = String
.format("Error while issuing out-of-band management action %s for host: %s", powerOperation.name(), host.getName());

ActionEventUtils.onCreatedActionEvent(CallContext.current().getCallingUserId(), CallContext.current().getCallingAccountId(), EventVO.LEVEL_WARN,
EventTypes.EVENT_HOST_OUTOFBAND_MANAGEMENT_ACTION, true, eventMessage);
}
}
}