mirror of https://github.com/apache/cloudstack.git
CS-14437: Final changes to ensure proper tunnel creation (rebase problems)
This commit is contained in:
parent
1ced2ed424
commit
026ed52f1d
|
|
@ -625,15 +625,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>();
|
||||
|
|
@ -641,7 +641,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();
|
||||
|
|
@ -659,8 +659,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);
|
||||
|
|
|
|||
|
|
@ -138,10 +138,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:%4$s, host:%5$d)",
|
||||
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());
|
||||
|
|
@ -317,7 +313,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(
|
||||
|
|
|
|||
Loading…
Reference in New Issue