mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix: allow executing CopyCommand operations in parallel when it is set (#5960)
* Invoke the hypervisor guru instead of the guru cycle * Refactor * Remove unused import * Refactor error
This commit is contained in:
parent
fe03e306ac
commit
97d42e9980
@ -24,4 +24,6 @@ public interface HypervisorGuruManager extends Manager {
|
||||
HypervisorGuru getGuru(HypervisorType hypervisorType);
|
||||
|
||||
long getGuruProcessedCommandTargetHost(long hostId, Command cmd);
|
||||
|
||||
long getGuruProcessedCommandTargetHost(long hostId, Command cmd, HypervisorType hypervisorType);
|
||||
}
|
||||
|
||||
@ -342,10 +342,15 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
}
|
||||
Answer answer = null;
|
||||
try {
|
||||
|
||||
final long targetHostId = _hvGuruMgr.getGuruProcessedCommandTargetHost(host.getId(), cmd);
|
||||
final long targetHostId = _hvGuruMgr.getGuruProcessedCommandTargetHost(host.getId(), cmd, host.getHypervisorType());
|
||||
answer = easySend(targetHostId, cmd);
|
||||
} catch (final Exception e) {
|
||||
String errorMsg = String.format("Error sending command %s to host %s, due to %s", cmd.getClass().getName(),
|
||||
host.getUuid(), e.getLocalizedMessage());
|
||||
s_logger.error(errorMsg);
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug(errorMsg, e);
|
||||
}
|
||||
}
|
||||
if (answer != null) {
|
||||
return answer;
|
||||
|
||||
@ -81,6 +81,13 @@ public class HypervisorGuruManagerImpl extends ManagerBase implements Hypervisor
|
||||
return hostId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGuruProcessedCommandTargetHost(long hostId, Command cmd, HypervisorType hypervisorType) {
|
||||
HypervisorGuru guru = getGuru(hypervisorType);
|
||||
Pair<Boolean, Long> result = guru.getCommandHostDelegation(hostId, cmd);
|
||||
return result.first() ? result.second() : hostId;
|
||||
}
|
||||
|
||||
public List<HypervisorGuru> getHvGuruList() {
|
||||
return _hvGuruList;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user