You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2020/11/10 20:49:03 UTC
[cloudstack] branch master updated: Create Event in case of OOBM
failure (#4418)
This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new 823111d Create Event in case of OOBM failure (#4418)
823111d is described below
commit 823111ddb7dc9adf7d3100be6315454b40d08bec
Author: Gabriel Beims Bräscher <ga...@apache.org>
AuthorDate: Tue Nov 10 17:48:37 2020 -0300
Create Event in case of OOBM failure (#4418)
---
.../cloudstack/outofbandmanagement/PowerOperationTask.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/server/src/main/java/org/apache/cloudstack/outofbandmanagement/PowerOperationTask.java b/server/src/main/java/org/apache/cloudstack/outofbandmanagement/PowerOperationTask.java
index 9c346d7..0bb1977 100644
--- a/server/src/main/java/org/apache/cloudstack/outofbandmanagement/PowerOperationTask.java
+++ b/server/src/main/java/org/apache/cloudstack/outofbandmanagement/PowerOperationTask.java
@@ -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 {
@@ -43,8 +47,14 @@ public class PowerOperationTask implements Runnable {
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);
}
}
}