From ef13158c2b950b0e1a73d3f8d9db5e0804a41686 Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Tue, 24 Apr 2012 15:21:41 +0100 Subject: [PATCH] CS-14437: Fixing remaining merge issues affecting tunnel creation Tunnel networks now work on this branch (VLAN networks never stopped working) --- .../hypervisor/xen/resource/CitrixResourceBase.java | 12 ++++++------ .../com/cloud/network/ovs/OvsTunnelManagerImpl.java | 8 ++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 09bdddb005a..0f193340274 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -621,15 +621,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe /** * This method just creates a XenServer network following the tunnel network naming convention */ - private synchronized Network findOrCreateTunnelNetwork(Connection conn, long networkId) { + private synchronized Network findOrCreateTunnelNetwork(Connection conn, long key) { try { - String nwName = "OVSTunnel" + networkId; + String nwName = "OVSTunnel" + key; Network nw = null; Network.Record rec = new Network.Record(); Set networks = Network.getByNameLabel(conn, nwName); if (networks.size() == 0) { - rec.nameDescription = "tunnel network id# " + networkId; + rec.nameDescription = "tunnel network id# " + key; rec.nameLabel = nwName; //Initialize the ovs-host-setup to avoid error when doing get-param in plugin Map otherConfig = new HashMap(); @@ -637,7 +637,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe rec.otherConfig = otherConfig; nw = Network.create(conn, rec); // Plug dom0 vif only when creating network - enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + networkId); + enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + key); s_logger.debug("### Xen Server network for tunnels created:" + nwName); } else { nw = networks.iterator().next(); @@ -655,8 +655,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe */ private synchronized Network configureTunnelNetwork(Connection conn, long networkId, long hostId, int key) { try { - Network nw = findOrCreateTunnelNetwork(conn, networkId); - String nwName = "OVSTunnel" + key; + Network nw = findOrCreateTunnelNetwork(conn, key); + String nwName = "OVSTunnel" + key; //Invoke plugin to setup the bridge which will be used by this network String bridge = nw.getBridge(conn); Map nwOtherConfig = nw.getOtherConfig(conn); diff --git a/server/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java b/server/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java index 912b7fdd655..cae56d10aa0 100644 --- a/server/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java +++ b/server/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java @@ -142,10 +142,6 @@ public class OvsTunnelManagerImpl implements OvsTunnelManager { private String handleFetchInterfaceAnswer(Answer[] answers, Long hostId){ OvsFetchInterfaceAnswer ans = (OvsFetchInterfaceAnswer) answers[0]; - String s = String.format( - "(ip:%1$s, netmask:%2$s, mac:%3$s, label:%4s, host:%5l)", - ans.getIp(), ans.getNetmask(), ans.getMac(), ans.getLabel(), hostId); - s_logger.debug("### About to add DB entry for:" + s); OvsTunnelInterfaceVO ti = createInterfaceRecord(ans.getIp(), ans.getNetmask(), ans.getMac(), hostId, ans.getLabel()); s_logger.debug("### Interface added to DB - id:" + ti.getId()); @@ -299,7 +295,7 @@ public class OvsTunnelManagerImpl implements OvsTunnelManager { } } //FIXME: Why are we cancelling the exception here? - try { + try { String myIp = getGreEndpointIP(dest.getHost(), nw); boolean noHost = true; for (Long i : toHostIds) { @@ -325,7 +321,7 @@ public class OvsTunnelManagerImpl implements OvsTunnelManager { handleCreateTunnelAnswer(answers); noHost = false; } - // If not tunnels have been configured, perform the bridge setup anyway + // 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(