public Host createHostAndAgent(Long hostId, ServerResource resource, Map<String, String> details, boolean old, List<String> hostTags,
boolean forRebalance) {
Host host = null;
if (_agentMgr.tapLoadingAgents(hostId, TapAgentsAction.Add)) {
try {
AgentAttache agentattache = _agentMgr.findAttache(hostId);
if (agentattache == null) {
s_logger.debug("Creating agent for host " + hostId);
host = createHostAndAgent(resource, details, old, hostTags, forRebalance);
s_logger.debug("Completed creating agent for host " + hostId);
} else {