CS-14437: Fixing remaining merge issues affecting tunnel creation

Tunnel networks now work on this branch
(VLAN networks never stopped working)
This commit is contained in:
Salvatore Orlando 2012-04-24 15:21:41 +01:00
parent 5c58aeaa04
commit ef13158c2b
2 changed files with 8 additions and 12 deletions

View File

@ -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<Network> 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<String,String> otherConfig = new HashMap<String,String>();
@ -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<String,String> nwOtherConfig = nw.getOtherConfig(conn);

View File

@ -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(