DaanHoogland commented on a change in pull request #5960:
URL: https://github.com/apache/cloudstack/pull/5960#discussion_r801367446



##########
File path: 
engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
##########
@@ -342,10 +343,12 @@ public Answer sendTo(final Long dcId, final 
HypervisorType type, final Command c
                 }
                 Answer answer = null;
                 try {
-
-                    final long targetHostId = 
_hvGuruMgr.getGuruProcessedCommandTargetHost(host.getId(), cmd);
+                    HypervisorGuru hvGuru = 
_hvGuruMgr.getGuru(host.getHypervisorType());
+                    Pair<Boolean, Long> result = 
hvGuru.getCommandHostDelegation(host.getId(), cmd);
+                    final long targetHostId = result.first() ? result.second() 
: host.getId();
                     answer = easySend(targetHostId, cmd);
                 } catch (final Exception e) {
+                    s_logger.error("Error sending command to host", e);

Review comment:
       can we include `cmd` and `targetHostId`, or the hosts name or uuid in 
the log message? 

##########
File path: 
engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
##########
@@ -342,10 +343,12 @@ public Answer sendTo(final Long dcId, final 
HypervisorType type, final Command c
                 }
                 Answer answer = null;
                 try {
-
-                    final long targetHostId = 
_hvGuruMgr.getGuruProcessedCommandTargetHost(host.getId(), cmd);
+                    HypervisorGuru hvGuru = 
_hvGuruMgr.getGuru(host.getHypervisorType());
+                    Pair<Boolean, Long> result = 
hvGuru.getCommandHostDelegation(host.getId(), cmd);
+                    final long targetHostId = result.first() ? result.second() 
: host.getId();

Review comment:
       isn't this bit responsibility of the `HypervisorGuruManager` ?




-- 
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.

To unsubscribe, e-mail: [email protected]

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


Reply via email to