String result = callHostPlugin(conn, "ovsgre", "ovs_create_gre", "bridge", bridge,
"remoteIP", cmd.getRemoteIp(), "greKey", cmd.getKey(), "from",
Long.toString(cmd.getFrom()), "to", Long.toString(cmd.getTo()));
String[] res = result.split(":");
if (res.length != 2 || (res.length == 2 && res[1].equalsIgnoreCase("[]"))) {
return new OvsCreateGreTunnelAnswer(cmd, false, result,
_host.ip, bridge);
} else {
return new OvsCreateGreTunnelAnswer(cmd, true, result, _host.ip, bridge, Integer.parseInt(res[1]));
}
} catch (BadServerResponse e) {
s_logger.error("An error occurred while creating a GRE tunnel to " +
cmd.getRemoteIp() + " on host " + _host.ip , e);
} catch (XenAPIException e) {
s_logger.error("An error occurred while creating a GRE tunnel to " +
cmd.getRemoteIp() + " on host " + _host.ip , e);
} catch (XmlRpcException e) {
s_logger.error("An error occurred while creating a GRE tunnel to " +
cmd.getRemoteIp() + " on host " + _host.ip , e);
}
return new OvsCreateGreTunnelAnswer(cmd, false, "EXCEPTION", _host.ip, bridge);
}