wido commented on a change in pull request #4418:
URL: https://github.com/apache/cloudstack/pull/4418#discussion_r509924874



##########
File path: 
server/src/main/java/org/apache/cloudstack/outofbandmanagement/PowerOperationTask.java
##########
@@ -43,8 +53,26 @@ 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 id=%d name=%s failed with: %s",
+                    powerOperation.name(), host.getId(), host.getName(), 
e.getMessage()));
+
+            if(CREATE_EVENT_ON_OOBM_FAILURE.value()) {
+                String eventMessage = String.format("Error while issuing 
out-of-band management action (%s) for host (id: %d, name: %s)",
+                        powerOperation.name(), host.getId(), host.getName());

Review comment:
       Same applies here

##########
File path: 
server/src/main/java/org/apache/cloudstack/outofbandmanagement/PowerOperationTask.java
##########
@@ -43,8 +53,26 @@ 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 id=%d name=%s failed with: %s",
+                    powerOperation.name(), host.getId(), host.getName(), 
e.getMessage()));

Review comment:
       In general in CloudStack we try to not log the 'hostid' as it doesn't 
say anything. The ID can only be fetched from the DB and not from the API and 
thus UI.

##########
File path: 
server/src/main/java/org/apache/cloudstack/outofbandmanagement/PowerOperationTask.java
##########
@@ -17,16 +17,26 @@
 
 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.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.log4j.Logger;
 
-public class PowerOperationTask implements Runnable {
+public class PowerOperationTask implements Runnable, Configurable {
     public static final Logger LOG = 
Logger.getLogger(PowerOperationTask.class);
 
     final private OutOfBandManagementService service;
     final private Host host;
     final private OutOfBandManagement.PowerOperation powerOperation;
 
+    public static final ConfigKey<Boolean> CREATE_EVENT_ON_OOBM_FAILURE = new 
ConfigKey<Boolean>("Advanced", Boolean.class, "create.event.on.oob.failure", 
"true",

Review comment:
       I know there is no naming scheme here, but isn't it easier if OOB 
related config keys are prefixed with *oob*?
   
   <pre>oob.create.event.on.failure</pre>
   
   For example




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to