Commit a2645114 authored by wutu's avatar wutu

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

parent 8e2e57da
Pipeline #9 passed with stage
in 0 seconds
......@@ -21,7 +21,7 @@ public class OvsDockerUtilsImpl implements OvsDockerUtils {
@Override
public String addPort(String bridgeName, String devName,
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;
String res = linuxCtlUtils.runCmd(cmd);
if(res.contains("Error")) {
......@@ -37,7 +37,7 @@ public class OvsDockerUtilsImpl implements OvsDockerUtils {
@Override
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;
return linuxCtlUtils.runCmd(cmd);
......
......@@ -40,7 +40,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override
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);
return ovs;
......@@ -128,7 +128,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override
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);
if(res.contains("Error")) {
throw new RuntimeException("linux bridge has existed!");
......@@ -137,7 +137,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override
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);
if(res.contains("Error")) {
throw new RuntimeException(res);
......@@ -146,7 +146,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override
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);
if(res.contains("Error")) {
throw new RuntimeException(res);
......@@ -155,7 +155,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override
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);
String res = linuxCtlUtils.runCmd(cmd);
if(res.contains("Error")) {
......@@ -171,7 +171,7 @@ public class OvsUtilsImpl implements OvsUtils {
*/
@Override
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);
LOG.info("为Bridge:{} 添加Port:{}", bridgeName, port);
if(!"".equals(res)) {
......@@ -183,7 +183,7 @@ public class OvsUtilsImpl implements OvsUtils {
@Override
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);
String res = linuxCtlUtils.runCmd(cmd);
if(!"".equals(res)) {
......@@ -203,7 +203,7 @@ public class OvsUtilsImpl implements OvsUtils {
public String[] createVethPair(String br1, String br2) {
String veth1 = br1 + "_" + br2;
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);
String res = linuxCtlUtils.runCmd(cmd);
if(!"".equals(res)) {
......@@ -221,7 +221,7 @@ public class OvsUtilsImpl implements OvsUtils {
public boolean delVethPort(String[] veths) {
String veth1 = veths[0];
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);
String res = linuxCtlUtils.runCmd(cmd);
if(!"".equals(res)) {
......@@ -239,7 +239,7 @@ public class OvsUtilsImpl implements OvsUtils {
*/
@Override
public boolean enableLinuxPort(String port) {
String cmd = "echo 'Vudo3423' | sudo -S ifconfig " + port + " up";
String cmd = "ifconfig " + port + " up";
LOG.info("启动Linux端口:{}",port);
String res = linuxCtlUtils.runCmd(cmd);
if(!"".equals(res)) {
......@@ -275,7 +275,7 @@ public class OvsUtilsImpl implements OvsUtils {
public boolean setVxlan(String bridgeName, String remoteIp) {
// TODO: bug
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;
System.out.println(cmd);
LOG.info("设置VXLAN[bridgeName:{},remoteIP:{},{}]", bridgeName, remoteIp,cmd);
......
......@@ -37,7 +37,7 @@ public class DockerServiceTests {
@Test
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);
}
......
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