String otherIp = getGreEndpointIP(rHost, nw);
if (otherIp == null)
throw new GreTunnelException("Unable to retrieve the remote " +
"endpoint for the GRE tunnel." +
"Failure is on host:" + rHost.getId());
Commands cmds = new Commands(
new OvsCreateTunnelCommand(otherIp, key,
Long.valueOf(hostId), i, nw.getId(), myIp));
s_logger.debug("Ask host " + hostId +
" to create gre tunnel to " + i);
Answer[] answers = _agentMgr.send(hostId, cmds);
handleCreateTunnelAnswer(answers);
noHost = false;
}
for (Long i : fromHostIds) {
HostVO rHost = _hostDao.findById(i);
String otherIp = getGreEndpointIP(rHost, nw);
Commands cmds = new Commands(
new OvsCreateTunnelCommand(myIp, key, i,
Long.valueOf(hostId),
nw.getId(), otherIp));
s_logger.debug("Ask host " + i +
" to create gre tunnel to " + hostId);
Answer[] answers = _agentMgr.send(i, cmds);
handleCreateTunnelAnswer(answers);
noHost = false;
}
// If no tunnels have been configured, perform the bridge setup anyway
// This will ensure VIF rules will be triggered
if (noHost) {
Commands cmds = new Commands(
new OvsSetupBridgeCommand(key, hostId, nw.getId()));
s_logger.debug("Ask host " + hostId +
" to configure bridge for network:" + nw.getId());
Answer[] answers = _agentMgr.send(hostId, cmds);
handleSetupBridgeAnswer(answers);