String.format("(hostIP:%1$s, remoteIP:%2$s, bridge:%3$s," + "greKey:%4$s, portName:%5$s)",
r.getFromIp(), r.getToIp(), r.getBridge(), r.getKey(), r.getInPortName());
Long from = r.getFrom();
Long to = r.getTo();
long networkId = r.getNetworkId();
OvsTunnelNetworkVO tunnel = _tunnelNetworkDao.getByFromToNetwork(from, to, networkId);
if (tunnel == null) {
throw new CloudRuntimeException(
String.format("Unable find tunnelNetwork record" +
"(from=%1$s,to=%2$s, account=%3$s",
from, to, networkId));
}
if (!r.getResult()) {
tunnel.setState(OvsTunnel.State.Failed.name());
s_logger.warn("Create GRE tunnel from " + from + " to " + to + " failed due to " + r.getDetails()
+ s);
} else {
tunnel.setState(OvsTunnel.State.Established.name());
tunnel.setPortName(r.getInPortName());
s_logger.info("Create GRE tunnel from " + from + " to " + to + " succeeded." + r.getDetails() + s);
}
_tunnelNetworkDao.update(tunnel.getId(), tunnel);
}