@Override
public boolean processCommands(long agentId, long seq, Command[] cmds) {
boolean processed = false;
for (Command cmd : cmds) {
if (cmd instanceof PingRoutingCommand) {
PingRoutingCommand ping = (PingRoutingCommand)cmd;
if (ping.getNewStates() != null && ping.getNewStates().size() > 0) {
if (!VmJobEnabled.value()) {
Commands commands = deltaHostSync(agentId, ping.getNewStates());
if (commands.size() > 0) {
try {
_agentMgr.send(agentId, commands, this);
} catch (final AgentUnavailableException e) {
s_logger.warn("Agent is now unavailable", e);
}
}
}
}
if(VmJobEnabled.value()) {
if (ping.getHostVmStateReport() != null && ping.getHostVmStateReport().size() > 0) {
_syncMgr.processHostVmStatePingReport(agentId, ping.getHostVmStateReport());
}
}
// take the chance to scan VMs that are stuck in transitional states
// and are missing from the report