Commit a2645114 authored by wutu's avatar wutu

修改为默认在root目录下进行部署,去掉原有的账户密码强绑定关系

parent 8e2e57da
Pipeline #103 passed with stage
in 0 seconds
...@@ -21,7 +21,7 @@ public class OvsDockerUtilsImpl implements OvsDockerUtils { ...@@ -21,7 +21,7 @@ public class OvsDockerUtilsImpl implements OvsDockerUtils {
@Override @Override
public String addPort(String bridgeName, String devName, public String addPort(String bridgeName, String devName,
String containerId, String ip) { String containerId, String ip) {
String cmd = "echo 'Vudo3423' | sudo -S ovs-docker add-port " + bridgeName String cmd = "ovs-docker add-port " + bridgeName
+ " " + devName + " " + containerId + " --ipaddress=" + ip; + " " + devName + " " + containerId + " --ipaddress=" + ip;
String res = linuxCtlUtils.runCmd(cmd); String res = linuxCtlUtils.runCmd(cmd);
if(res.contains("Error")) { if(res.contains("Error")) {
...@@ -37,7 +37,7 @@ public class OvsDockerUtilsImpl implements OvsDockerUtils { ...@@ -37,7 +37,7 @@ public class OvsDockerUtilsImpl implements OvsDockerUtils {
@Override @Override
public String delPort(String bridgeName, String devName, String containerId) { public String delPort(String bridgeName, String devName, String containerId) {
String cmd = "echo 'Vudo3423' | sudo -S ovs-docker del-port " + bridgeName + " " String cmd = "ovs-docker del-port " + bridgeName + " "
+ devName + " " + containerId; + devName + " " + containerId;
return linuxCtlUtils.runCmd(cmd); return linuxCtlUtils.runCmd(cmd);
......
...@@ -40,7 +40,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -40,7 +40,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override @Override
public Ovs showDetails() { public Ovs showDetails() {
String res = linuxCtlUtils.runCmd("echo 'Vudo3423' | sudo -S ovs-vsctl show"); String res = linuxCtlUtils.runCmd("ovs-vsctl show");
Ovs ovs = parseOvsString(res); Ovs ovs = parseOvsString(res);
return ovs; return ovs;
...@@ -128,7 +128,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -128,7 +128,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override @Override
public void addBridge(String name) { public void addBridge(String name) {
String cmd = "echo 'Vudo3423' | sudo -S ovs-vsctl add-br " + name; String cmd = "ovs-vsctl add-br " + name;
String res = linuxCtlUtils.runCmd(cmd); String res = linuxCtlUtils.runCmd(cmd);
if(res.contains("Error")) { if(res.contains("Error")) {
throw new RuntimeException("linux bridge has existed!"); throw new RuntimeException("linux bridge has existed!");
...@@ -137,7 +137,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -137,7 +137,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override @Override
public void setBridgeProtocol(String bridgeName, String protocol) { public void setBridgeProtocol(String bridgeName, String protocol) {
String cmd = "echo 'Vudo3423' | sudo -S ovs-vsctl set bridge " + bridgeName + " protocols=" + protocol; String cmd = "ovs-vsctl set bridge " + bridgeName + " protocols=" + protocol;
String res = linuxCtlUtils.runCmd(cmd); String res = linuxCtlUtils.runCmd(cmd);
if(res.contains("Error")) { if(res.contains("Error")) {
throw new RuntimeException(res); throw new RuntimeException(res);
...@@ -146,7 +146,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -146,7 +146,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override @Override
public void setController(String bridgeName, String host, int port) { public void setController(String bridgeName, String host, int port) {
String cmd = "echo 'Vudo3423' | sudo -S ovs-vsctl set-controller " + bridgeName + " tcp:" + host + ":" + port; String cmd = "ovs-vsctl set-controller " + bridgeName + " tcp:" + host + ":" + port;
String res = linuxCtlUtils.runCmd(cmd); String res = linuxCtlUtils.runCmd(cmd);
if(res.contains("Error")) { if(res.contains("Error")) {
throw new RuntimeException(res); throw new RuntimeException(res);
...@@ -155,7 +155,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -155,7 +155,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override @Override
public void delBridge(String name) { public void delBridge(String name) {
String cmd = "echo 'Vudo3423' | sudo -S ovs-vsctl del-br " + name; String cmd = "ovs-vsctl del-br " + name;
LOG.info("删除网桥[{}]", name); LOG.info("删除网桥[{}]", name);
String res = linuxCtlUtils.runCmd(cmd); String res = linuxCtlUtils.runCmd(cmd);
if(res.contains("Error")) { if(res.contains("Error")) {
...@@ -171,7 +171,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -171,7 +171,7 @@ public class OvsUtilsImpl implements OvsUtils {
*/ */
@Override @Override
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 = "ovs-vsctl add-port " + bridgeName + " " + port;
String res = linuxCtlUtils.runCmd(cmd); String res = linuxCtlUtils.runCmd(cmd);
LOG.info("为Bridge:{} 添加Port:{}", bridgeName, port); LOG.info("为Bridge:{} 添加Port:{}", bridgeName, port);
if(!"".equals(res)) { if(!"".equals(res)) {
...@@ -183,7 +183,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -183,7 +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 = "ovs-vsctl del-port " + bridgeName + " " + port;
LOG.info("删除Bridge:{} 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)) {
...@@ -203,7 +203,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -203,7 +203,7 @@ public class OvsUtilsImpl implements OvsUtils {
public String[] createVethPair(String br1, String br2) { public String[] createVethPair(String br1, String br2) {
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 = "ip link add " + veth1 + " type veth peer name " + veth2;
LOG.info("创建虚拟网卡对[{},{}]", veth1, veth2); LOG.info("创建虚拟网卡对[{},{}]", veth1, veth2);
String res = linuxCtlUtils.runCmd(cmd); String res = linuxCtlUtils.runCmd(cmd);
if(!"".equals(res)) { if(!"".equals(res)) {
...@@ -221,7 +221,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -221,7 +221,7 @@ public class OvsUtilsImpl implements OvsUtils {
public boolean delVethPort(String[] veths) { public boolean delVethPort(String[] veths) {
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 = "ip link del " + veth1 + " type veth peer name " + veth2;
LOG.info("删除虚拟网卡对[{},{}]", veth1, veth2); LOG.info("删除虚拟网卡对[{},{}]", veth1, veth2);
String res = linuxCtlUtils.runCmd(cmd); String res = linuxCtlUtils.runCmd(cmd);
if(!"".equals(res)) { if(!"".equals(res)) {
...@@ -239,7 +239,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -239,7 +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 = "ifconfig " + port + " up";
LOG.info("启动Linux端口:{}",port); LOG.info("启动Linux端口:{}",port);
String res = linuxCtlUtils.runCmd(cmd); String res = linuxCtlUtils.runCmd(cmd);
if(!"".equals(res)) { if(!"".equals(res)) {
...@@ -275,7 +275,7 @@ public class OvsUtilsImpl implements OvsUtils { ...@@ -275,7 +275,7 @@ public class OvsUtilsImpl implements OvsUtils {
public boolean setVxlan(String bridgeName, String remoteIp) { public boolean setVxlan(String bridgeName, String remoteIp) {
// TODO: bug // TODO: bug
int id = atomicInteger.getAndIncrement(); int id = atomicInteger.getAndIncrement();
String cmd = "echo 'Vudo3423' | sudo -S ovs-vsctl add-port " + bridgeName String cmd = "ovs-vsctl add-port " + bridgeName
+ " vxlan" + id + " -- set interface vxlan" + id + " type=vxlan options:remote_ip=" + remoteIp; + " vxlan" + id + " -- set interface vxlan" + id + " type=vxlan options:remote_ip=" + remoteIp;
System.out.println(cmd); System.out.println(cmd);
LOG.info("设置VXLAN[bridgeName:{},remoteIP:{},{}]", bridgeName, remoteIp,cmd); LOG.info("设置VXLAN[bridgeName:{},remoteIP:{},{}]", bridgeName, remoteIp,cmd);
......
...@@ -37,7 +37,7 @@ public class DockerServiceTests { ...@@ -37,7 +37,7 @@ public class DockerServiceTests {
@Test @Test
public void testSudo() { public void testSudo() {
String result = linuxCtlService.runCmd("echo Vudo3423 | sudo -S ovs-vsctl show"); String result = linuxCtlService.runCmd("ovs-vsctl show");
System.out.println(result); System.out.println(result);
} }
......
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