@Override public Answer sendMessage(Command cmd) { String errMsg = null; try { long newHostId = _hvGuruMgr.getGuruProcessedCommandTargetHost(hostId, cmd); if (newHostId != hostId) { // update endpoint with new host if changed setId(newHostId); } return agentMgr.send(newHostId, cmd); } catch (AgentUnavailableException e) { errMsg = e.toString(); s_logger.debug("Failed to send command, due to Agent:" + getId() + ", " + e.toString()); } catch (OperationTimedoutException e) { errMsg = e.toString(); s_logger.debug("Failed to send command, due to Agent:" + getId() + ", " + e.toString()); } throw new CloudRuntimeException("Failed to send command, due to Agent:" + getId() + ", " + errMsg); }
protected void handleVmMigrated(VMInstanceVO vm) { if (!isVmSecurityGroupEnabled(vm.getId())) { return; } if (vm.getType() != VirtualMachine.Type.User) { Commands cmds = null; NetworkRulesSystemVmCommand nrc = new NetworkRulesSystemVmCommand(vm.getInstanceName(), vm.getType()); cmds = new Commands(nrc); try { _agentMgr.send(vm.getHostId(), cmds); } catch (AgentUnavailableException e) { s_logger.debug(e.toString()); } catch (OperationTimedoutException e) { s_logger.debug(e.toString()); } } else { List<Long> affectedVms = new ArrayList<Long>(); affectedVms.add(vm.getId()); scheduleRulesetUpdateToHosts(affectedVms, true, null); } }
_agentMgr.send(vm.getHostId(), cmds); } catch (AgentUnavailableException e) { s_logger.debug(e.toString()); } catch (OperationTimedoutException e) { s_logger.debug(e.toString());
s_logger.warn("Unable to stop vm, agent unavailable: " + e.toString()); } catch (final OperationTimedoutException e) { s_logger.warn("Unable to stop vm, operation timed out: " + e.toString());
} catch (AgentUnavailableException e) { s_logger.debug("Creating VM snapshot: " + vmSnapshot.getName() + " failed", e); throw new CloudRuntimeException("Creating VM snapshot: " + vmSnapshot.getName() + " failed: " + e.toString()); } finally { if (!result) {