Commit 61788084 authored by wutu's avatar wutu

发现几处代码错误

parent 86a5047d
...@@ -87,7 +87,7 @@ public class TopologyServiceImpl implements TopologyService { ...@@ -87,7 +87,7 @@ public class TopologyServiceImpl implements TopologyService {
if(appName2.startsWith("br:")) { if(appName2.startsWith("br:")) {
flag++; flag++;
// 创建对应的虚拟交换机 // 创建对应的虚拟交换机
if(!ovsService.isBridge(appName2)) { if(!ovsService.isBridge(appName2.substring(3))) {
LOG.info("Create Ovs Bridge!"); LOG.info("Create Ovs Bridge!");
ovsService.addBridge(appName2.substring(3)); ovsService.addBridge(appName2.substring(3));
} }
...@@ -135,7 +135,7 @@ public class TopologyServiceImpl implements TopologyService { ...@@ -135,7 +135,7 @@ public class TopologyServiceImpl implements TopologyService {
// 如果其中一个是虚拟交换机,则创建虚拟交换机到容器的连接 // 如果其中一个是虚拟交换机,则创建虚拟交换机到容器的连接
else if(flag == 1) { else if(flag == 1) {
String ovsName = appName1.startsWith("br:") ? appName1.substring(3) : appName2.substring(3); String ovsName = appName1.startsWith("br:") ? appName1.substring(3) : appName2.substring(3);
String containerName = appName1.startsWith("br:") ? appName2 : appName2; String containerName = appName1.startsWith("br:") ? appName2 : appName1;
// 使用ovsDocker接口创建连接 // 使用ovsDocker接口创建连接
// 获取全部的APP容器id // 获取全部的APP容器id
......
...@@ -144,6 +144,12 @@ public class OVSServiceImpl implements OVSService, InitializingBean { ...@@ -144,6 +144,12 @@ public class OVSServiceImpl implements OVSService, InitializingBean {
public void addBridge(String bridgeName) { public void addBridge(String bridgeName) {
// TODO: 优化下返回值 // TODO: 优化下返回值
ovsUtils.addBridge(bridgeName); ovsUtils.addBridge(bridgeName);
// 这里增加一个时延,防止后端ovs检测不到br
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment