Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Distributed Computing and Network Fusion System
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WirelessInformationCollaborate
Distributed Computing and Network Fusion System
Commits
06ba3f12
Commit
06ba3f12
authored
Jan 31, 2020
by
wutu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加启动自检魔抗,并优化日志
parent
7277cf02
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
180 additions
and
14 deletions
+180
-14
bishe-cloud-center/src/main/resources/application.yml
bishe-cloud-center/src/main/resources/application.yml
+2
-2
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/check/ClusterServiceCheck.java
...java/top/ninwoo/edgecenter/check/ClusterServiceCheck.java
+147
-0
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/config/ZookeeperConfiguration.java
.../top/ninwoo/edgecenter/config/ZookeeperConfiguration.java
+17
-1
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/service/impl/TopologyServiceImpl.java
...p/ninwoo/edgecenter/service/impl/TopologyServiceImpl.java
+3
-4
bishe-edge-center/src/main/resources/application.yaml
bishe-edge-center/src/main/resources/application.yaml
+3
-3
bishe-utils/src/main/java/top/ninwoo/utils/service/impl/DockerServiceImpl.java
...java/top/ninwoo/utils/service/impl/DockerServiceImpl.java
+1
-1
bishe-utils/src/main/java/top/ninwoo/utils/service/impl/OVSServiceImpl.java
...in/java/top/ninwoo/utils/service/impl/OVSServiceImpl.java
+1
-0
bishe-utils/src/main/java/top/ninwoo/utils/util/impl/OvsUtilsImpl.java
...rc/main/java/top/ninwoo/utils/util/impl/OvsUtilsImpl.java
+6
-3
No files found.
bishe-cloud-center/src/main/resources/application.yml
View file @
06ba3f12
...
@@ -2,10 +2,10 @@ server:
...
@@ -2,10 +2,10 @@ server:
port
:
9090
port
:
9090
zookeeper
:
zookeeper
:
url
:
192.168.
31.154
:2181
url
:
192.168.
1.5
:2181
bs
:
bs
:
cloudcenter
:
cloudcenter
:
name
:
my-bs-cloud-center
name
:
my-bs-cloud-center
ipservice
:
ipservice
:
url
:
127.0.0.1:23333
url
:
192.168.1.5:23333
\ No newline at end of file
\ No newline at end of file
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/check/ClusterServiceCheck.java
0 → 100644
View file @
06ba3f12
package
top.ninwoo.edgecenter.check
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.junit.Assert
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
top.ninwoo.common.entity.ClusterConfig
;
import
top.ninwoo.common.entity.ContainerDescription
;
import
top.ninwoo.common.entity.DockerContainer
;
import
top.ninwoo.common.entity.NetworkTopology
;
import
top.ninwoo.edgecenter.service.ClusterService
;
import
top.ninwoo.edgecenter.service.IpService
;
import
top.ninwoo.edgecenter.service.TopologyService
;
import
top.ninwoo.utils.service.DockerService
;
import
top.ninwoo.utils.util.LinuxCtlUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
/**
* Docker容器集群服务自检程序
*
* @author joliu
*/
@Slf4j
@Component
public
class
ClusterServiceCheck
{
@Autowired
private
ClusterService
clusterService
;
@Autowired
private
DockerService
dockerService
;
@Autowired
private
TopologyService
topologyService
;
@Autowired
private
LinuxCtlUtils
linuxCtlUtils
;
@Autowired
private
IpService
ipService
;
private
String
container1Id
;
private
String
container2Id
;
private
final
static
Long
CLUSTERID
=
12345L
;
public
void
createCluster
()
{
log
.
info
(
"启动容器自检服务"
);
// 构建一个容器组配置
ClusterConfig
clusterConfig
=
new
ClusterConfig
();
clusterConfig
.
setId
(
CLUSTERID
);
clusterConfig
.
setOwner
(
"joliu"
);
ContainerDescription
containerDescription
=
new
ContainerDescription
();
containerDescription
.
setMode
(
"normal"
);
containerDescription
.
setReplicas
(
2
);
DockerContainer
container
=
new
DockerContainer
();
container
.
setName
(
"Test1"
);
container
.
setCommand
(
"sh"
);
container
.
setImage
(
"joliu/networktest"
);
containerDescription
.
setDockerContainer
(
container
);
List
<
ContainerDescription
>
cds
=
new
ArrayList
<>();
cds
.
add
(
containerDescription
);
ContainerDescription
containerDescription1
=
new
ContainerDescription
();
containerDescription1
.
setMode
(
"normal"
);
containerDescription1
.
setReplicas
(
1
);
DockerContainer
container1
=
new
DockerContainer
();
container1
.
setName
(
"Test2"
);
container1
.
setCommand
(
"sh"
);
container1
.
setImage
(
"joliu/networktest"
);
containerDescription1
.
setDockerContainer
(
container1
);
cds
.
add
(
containerDescription1
);
clusterConfig
.
setDockers
(
cds
);
NetworkTopology
topo
=
new
NetworkTopology
();
topo
.
setAppNames
(
new
String
[]{
"Test1"
,
"Test2"
,
"br:ovs1"
});
// 这个参数好像没啥用
topo
.
setTopologyId
(
11
);
topo
.
setTopology
(
new
int
[][]{{
0
,
0
,
0
},{
0
,
0
,
0
},{
1
,
1
,
0
}});
clusterConfig
.
setTopology
(
topo
);
//long id = clusterService.initContainers(clusterConfig).getId();
//Assert.assertEquals(id, clusterId);
log
.
info
(
"创建自检容器集群【Test1_0,Test1_1,Test2】"
);
try
{
clusterService
.
initContainers
(
clusterConfig
);
topologyService
.
createTopo
(
clusterConfig
.
getId
(),
clusterConfig
.
getTopology
());
}
catch
(
Exception
e
)
{
log
.
error
(
"容器启动失败"
);
throw
new
RuntimeException
(
"容器启动失败"
);
}
if
(!
clusterService
.
getClusterIds
().
contains
(
CLUSTERID
))
{
log
.
error
(
"集群创建失败%"
,
CLUSTERID
);
}
log
.
info
(
"容器集群[{}]创建成功"
,
CLUSTERID
);
Set
<
String
>
test1
=
clusterService
.
getContainerIdsByClusterId
(
CLUSTERID
,
"Test1"
);
log
.
info
(
"容器Test1副本创建成功:[{}]"
,
test1
);
Set
<
String
>
test2
=
clusterService
.
getContainerIdsByClusterId
(
CLUSTERID
,
"Test2"
);
log
.
info
(
"容器Test2副本创建成功:[{}]"
,
test2
);
log
.
info
(
"容器集群网络创建成功"
);
container1Id
=
((
String
)
test1
.
toArray
()[
0
]);
container2Id
=
((
String
)
test2
.
toArray
()[
0
]);
}
public
void
pingTest
()
{
// 测试网络
String
ovsResult
=
linuxCtlUtils
.
runCmd
(
"echo Vudo3423 | sudo -S ovs-vsctl show"
);
log
.
info
(
"Open vSwitch:{}"
,
ovsResult
);
// 获取container2的ip
// ifconfig eth1 |sed -rn '2s#^.*dr:(.*) Bc.*$#\1#gp'
try
{
Thread
.
sleep
(
500
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
String
containerIp
=
ipService
.
getContainerIp
(
container2Id
);
if
(
StringUtils
.
isEmpty
(
containerIp
))
{
log
.
error
(
"没有查询对应的容器IP,请检查IpService服务以及CreateTopo的服务"
);
}
String
cid2Ip
=
containerIp
.
split
(
"/"
)[
0
];
log
.
info
(
"容器1{} ping 容器2{} IP {}"
,
container1Id
,
container2Id
,
cid2Ip
);
String
pingResult
=
dockerService
.
execInDocker
(
container1Id
,
new
String
[]{
"ping"
,
cid2Ip
,
"-c"
,
"4"
});
log
.
info
(
"Ping Result:{}"
,
pingResult
);
log
.
info
(
"容器网络连通性测试成功"
);
}
public
void
delCluster
()
{
try
{
clusterService
.
removeContainersByClusterId
(
CLUSTERID
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"容器删除失败"
);
}
log
.
info
(
"容器集群[{}]删除成功"
,
CLUSTERID
);
}
public
void
delNetworkTopo
()
{
log
.
info
(
"开始删除测试容器网络"
);
topologyService
.
removeTopoByCluterId
(
12345L
);
log
.
info
(
"测试集群:{}:删除成功"
);
}
}
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/config/ZookeeperConfiguration.java
View file @
06ba3f12
package
top.ninwoo.edgecenter.config
;
package
top.ninwoo.edgecenter.config
;
import
javafx.scene.control.cell.TextFieldListCell
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.curator.framework.CuratorFramework
;
import
org.apache.curator.framework.CuratorFramework
;
import
org.apache.curator.framework.CuratorFrameworkFactory
;
import
org.apache.curator.framework.CuratorFrameworkFactory
;
import
org.apache.curator.retry.ExponentialBackoffRetry
;
import
org.apache.curator.retry.ExponentialBackoffRetry
;
...
@@ -13,10 +15,11 @@ import org.springframework.context.ApplicationContextAware;
...
@@ -13,10 +15,11 @@ import org.springframework.context.ApplicationContextAware;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.context.support.WebApplicationContextUtils
;
import
org.springframework.web.context.support.WebApplicationContextUtils
;
import
top.ninwoo.edgecenter.check.ClusterServiceCheck
;
import
top.ninwoo.edgecenter.register.EdgeNodeRegister
;
import
top.ninwoo.edgecenter.register.EdgeNodeRegister
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
@Slf4j
@Configuration
@Configuration
public
class
ZookeeperConfiguration
implements
ApplicationContextAware
{
public
class
ZookeeperConfiguration
implements
ApplicationContextAware
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ZookeeperConfiguration
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ZookeeperConfiguration
.
class
);
...
@@ -48,6 +51,19 @@ public class ZookeeperConfiguration implements ApplicationContextAware {
...
@@ -48,6 +51,19 @@ public class ZookeeperConfiguration implements ApplicationContextAware {
@Bean
@Bean
public
ApplicationRunner
applicationRunner
()
{
public
ApplicationRunner
applicationRunner
()
{
return
args
->
{
return
args
->
{
// 这里加入新的启动自检
ClusterServiceCheck
check
=
applicationContext
.
getBean
(
ClusterServiceCheck
.
class
);
try
{
check
.
createCluster
();
check
.
pingTest
();
}
catch
(
Exception
e
)
{
// 测试流程失败
log
.
error
(
"测试流程失败{}"
,
e
);
throw
new
RuntimeException
(
"Error"
);
}
finally
{
check
.
delCluster
();
check
.
delNetworkTopo
();
}
EdgeNodeRegister
bean
=
applicationContext
.
getBean
(
EdgeNodeRegister
.
class
);
EdgeNodeRegister
bean
=
applicationContext
.
getBean
(
EdgeNodeRegister
.
class
);
bean
.
registerNode
();
bean
.
registerNode
();
};
};
...
...
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/service/impl/TopologyServiceImpl.java
View file @
06ba3f12
...
@@ -87,20 +87,19 @@ public class TopologyServiceImpl implements TopologyService {
...
@@ -87,20 +87,19 @@ public class TopologyServiceImpl implements TopologyService {
// 创建对应的虚拟交换机
// 创建对应的虚拟交换机
// 在创建前需要检查,是否已经创建过对应的交换机
// 在创建前需要检查,是否已经创建过对应的交换机
if
(!
appName1
.
contains
(
"remote"
)
&&
!
ovsService
.
isBridge
(
appName1
.
substring
(
3
)))
{
if
(!
appName1
.
contains
(
"remote"
)
&&
!
ovsService
.
isBridge
(
appName1
.
substring
(
3
)))
{
LOG
.
info
(
"
Create Ovs Bridge!"
);
LOG
.
info
(
"
创建虚拟交换机:{}"
,
appName1
.
substring
(
3
)
);
ovsService
.
addBridge
(
appName1
.
substring
(
3
));
ovsService
.
addBridge
(
appName1
.
substring
(
3
));
}
}
LOG
.
info
(
"Ovs Bridge["
+
appName1
+
"] is normal!"
);
//
LOG.info("Ovs Bridge[" + appName1 + "] is normal!");
}
}
if
(
appName2
.
startsWith
(
"br:"
))
{
if
(
appName2
.
startsWith
(
"br:"
))
{
flag
++;
flag
++;
// 创建对应的虚拟交换机
// 创建对应的虚拟交换机
if
(!
appName2
.
contains
(
"remote"
)
&&
!
ovsService
.
isBridge
(
appName2
.
substring
(
3
)))
{
if
(!
appName2
.
contains
(
"remote"
)
&&
!
ovsService
.
isBridge
(
appName2
.
substring
(
3
)))
{
LOG
.
info
(
"
Create Ovs Bridge!"
);
LOG
.
info
(
"
创建虚拟交换机:{}"
,
appName2
.
substring
(
3
)
);
ovsService
.
addBridge
(
appName2
.
substring
(
3
));
ovsService
.
addBridge
(
appName2
.
substring
(
3
));
}
}
LOG
.
info
(
"Ovs Bridge["
+
appName2
+
"] is normal!"
);
}
}
// 如果两个都是虚拟交换机,则需要创建交换机连接
// 如果两个都是虚拟交换机,则需要创建交换机连接
...
...
bishe-edge-center/src/main/resources/application.yaml
View file @
06ba3f12
...
@@ -2,7 +2,7 @@ spring:
...
@@ -2,7 +2,7 @@ spring:
application
:
application
:
name
:
bishe-edge-center
name
:
bishe-edge-center
datasource
:
datasource
:
url
:
jdbc:mysql://opengn.org:32306/bishe
url
:
jdbc:mysql://opengn.org:32306/bishe
?useSSL=false
username
:
root
username
:
root
password
:
Vudo3423ljo
password
:
Vudo3423ljo
...
@@ -21,6 +21,6 @@ bs:
...
@@ -21,6 +21,6 @@ bs:
name
:
random
name
:
random
ip-prefix
:
192
ip-prefix
:
192
ipservice
:
ipservice
:
ip
:
192.168.
31.154
:23333
ip
:
192.168.
1.5
:23333
zookeeper
:
zookeeper
:
url
:
192.168.31.154:2181
url
:
192.168.1.5:2181
\ No newline at end of file
\ No newline at end of file
bishe-utils/src/main/java/top/ninwoo/utils/service/impl/DockerServiceImpl.java
View file @
06ba3f12
...
@@ -224,7 +224,7 @@ public class DockerServiceImpl implements DockerService, InitializingBean {
...
@@ -224,7 +224,7 @@ public class DockerServiceImpl implements DockerService, InitializingBean {
throw
new
RuntimeException
(
"容器不存在"
);
throw
new
RuntimeException
(
"容器不存在"
);
}
}
}
else
{
}
else
{
throw
new
RuntimeException
(
"容器不存在"
);
throw
new
RuntimeException
(
"容器不存在"
+
containerId
);
}
}
}
}
String
result
=
dockerUtils
.
execInDocker
(
containerId
,
args
);
String
result
=
dockerUtils
.
execInDocker
(
containerId
,
args
);
...
...
bishe-utils/src/main/java/top/ninwoo/utils/service/impl/OVSServiceImpl.java
View file @
06ba3f12
...
@@ -169,6 +169,7 @@ public class OVSServiceImpl implements OVSService, InitializingBean {
...
@@ -169,6 +169,7 @@ public class OVSServiceImpl implements OVSService, InitializingBean {
// 先创建虚拟网卡对
// 先创建虚拟网卡对
String
[]
vethPair
=
ovsUtils
.
createVethPair
(
br1
,
br2
);
String
[]
vethPair
=
ovsUtils
.
createVethPair
(
br1
,
br2
);
// 将虚拟网卡对的两端分别接入到ovs上
// 将虚拟网卡对的两端分别接入到ovs上
boolean
b
=
ovsUtils
.
addBridgePort
(
br1
,
vethPair
[
0
]);
boolean
b
=
ovsUtils
.
addBridgePort
(
br1
,
vethPair
[
0
]);
boolean
b1
=
ovsUtils
.
addBridgePort
(
br2
,
vethPair
[
1
]);
boolean
b1
=
ovsUtils
.
addBridgePort
(
br2
,
vethPair
[
1
]);
...
...
bishe-utils/src/main/java/top/ninwoo/utils/util/impl/OvsUtilsImpl.java
View file @
06ba3f12
...
@@ -172,7 +172,7 @@ public class OvsUtilsImpl implements OvsUtils {
...
@@ -172,7 +172,7 @@ public class OvsUtilsImpl implements OvsUtils {
public
boolean
addBridgePort
(
String
bridgeName
,
String
port
)
{
public
boolean
addBridgePort
(
String
bridgeName
,
String
port
)
{
String
cmd
=
"echo 'Vudo3423' | sudo -S ovs-vsctl add-port "
+
bridgeName
+
" "
+
port
;
String
cmd
=
"echo 'Vudo3423' | sudo -S ovs-vsctl add-port "
+
bridgeName
+
" "
+
port
;
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
LOG
.
info
(
"为Bridge:{} 添加Port:{}"
,
bridgeName
,
port
);
if
(!
""
.
equals
(
res
))
{
if
(!
""
.
equals
(
res
))
{
LOG
.
warn
(
"AddBridgePort:"
+
"["
+
bridgeName
+
","
+
port
+
"]"
+
res
);
LOG
.
warn
(
"AddBridgePort:"
+
"["
+
bridgeName
+
","
+
port
+
"]"
+
res
);
return
false
;
return
false
;
...
@@ -183,6 +183,7 @@ public class OvsUtilsImpl implements OvsUtils {
...
@@ -183,6 +183,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override
@Override
public
boolean
delBridgePort
(
String
bridgeName
,
String
port
)
{
public
boolean
delBridgePort
(
String
bridgeName
,
String
port
)
{
String
cmd
=
"echo 'Vudo3423' | sudo -S ovs-vsctl del-port "
+
bridgeName
+
" "
+
port
;
String
cmd
=
"echo 'Vudo3423' | sudo -S ovs-vsctl del-port "
+
bridgeName
+
" "
+
port
;
LOG
.
info
(
"删除Bridge:{} Port:{}"
,
bridgeName
,
port
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
if
(!
""
.
equals
(
res
))
{
if
(!
""
.
equals
(
res
))
{
LOG
.
warn
(
bridgeName
+
":"
+
port
+
"["
+
res
+
"]"
);
LOG
.
warn
(
bridgeName
+
":"
+
port
+
"["
+
res
+
"]"
);
...
@@ -202,7 +203,7 @@ public class OvsUtilsImpl implements OvsUtils {
...
@@ -202,7 +203,7 @@ public class OvsUtilsImpl implements OvsUtils {
String
veth1
=
br1
+
"_"
+
br2
;
String
veth1
=
br1
+
"_"
+
br2
;
String
veth2
=
br2
+
"_"
+
br1
;
String
veth2
=
br2
+
"_"
+
br1
;
String
cmd
=
"echo 'Vudo3423' | sudo -S ip link add "
+
veth1
+
" type veth peer name "
+
veth2
;
String
cmd
=
"echo 'Vudo3423' | sudo -S ip link add "
+
veth1
+
" type veth peer name "
+
veth2
;
LOG
.
info
(
"创建虚拟网卡对[{},{}]"
,
veth1
,
veth2
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
if
(!
""
.
equals
(
res
))
{
if
(!
""
.
equals
(
res
))
{
LOG
.
warn
(
"createVethPair:["
+
br1
+
","
+
br2
+
"]:"
+
res
);
LOG
.
warn
(
"createVethPair:["
+
br1
+
","
+
br2
+
"]:"
+
res
);
...
@@ -220,7 +221,7 @@ public class OvsUtilsImpl implements OvsUtils {
...
@@ -220,7 +221,7 @@ public class OvsUtilsImpl implements OvsUtils {
String
veth1
=
veths
[
0
];
String
veth1
=
veths
[
0
];
String
veth2
=
veths
[
1
];
String
veth2
=
veths
[
1
];
String
cmd
=
"echo 'Vudo3423' | sudo -S ip link del "
+
veth1
+
" type veth peer name "
+
veth2
;
String
cmd
=
"echo 'Vudo3423' | sudo -S ip link del "
+
veth1
+
" type veth peer name "
+
veth2
;
LOG
.
info
(
"删除虚拟网卡对[{},{}]"
,
veth1
,
veth2
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
if
(!
""
.
equals
(
res
))
{
if
(!
""
.
equals
(
res
))
{
LOG
.
warn
(
"delVethPair:["
+
veth1
+
","
+
veth2
+
"]:"
+
res
);
LOG
.
warn
(
"delVethPair:["
+
veth1
+
","
+
veth2
+
"]:"
+
res
);
...
@@ -238,6 +239,7 @@ public class OvsUtilsImpl implements OvsUtils {
...
@@ -238,6 +239,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override
@Override
public
boolean
enableLinuxPort
(
String
port
)
{
public
boolean
enableLinuxPort
(
String
port
)
{
String
cmd
=
"echo 'Vudo3423' | sudo -S ifconfig "
+
port
+
" up"
;
String
cmd
=
"echo 'Vudo3423' | sudo -S ifconfig "
+
port
+
" up"
;
LOG
.
info
(
"启动Linux端口:{}"
,
port
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
if
(!
""
.
equals
(
res
))
{
if
(!
""
.
equals
(
res
))
{
LOG
.
warn
(
"EnbaleLinuxPort:"
+
"["
+
port
+
"]:"
+
port
);
LOG
.
warn
(
"EnbaleLinuxPort:"
+
"["
+
port
+
"]:"
+
port
);
...
@@ -273,6 +275,7 @@ public class OvsUtilsImpl implements OvsUtils {
...
@@ -273,6 +275,7 @@ public class OvsUtilsImpl implements OvsUtils {
// TODO: bug
// TODO: bug
String
cmd
=
"echo 'Vudo3423' | sudo -S ovs-vsctl add-port "
+
bridgeName
String
cmd
=
"echo 'Vudo3423' | sudo -S ovs-vsctl add-port "
+
bridgeName
+
" vxlan0 -- set interface vxlan0 type=vxlan options:remote_ip="
+
remoteIp
;
+
" vxlan0 -- set interface vxlan0 type=vxlan options:remote_ip="
+
remoteIp
;
LOG
.
info
(
"设置VXLAN[bridgeName:{},remoteIP:{}]"
,
bridgeName
,
remoteIp
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
String
res
=
linuxCtlUtils
.
runCmd
(
cmd
);
if
(!
""
.
equals
(
res
))
{
if
(!
""
.
equals
(
res
))
{
LOG
.
warn
(
"setVxlan:"
+
"["
+
bridgeName
+
"]:"
+
res
);
LOG
.
warn
(
"setVxlan:"
+
"["
+
bridgeName
+
"]:"
+
res
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment