Commit 8e2e57da authored by wutu's avatar wutu

优化异常处理

parent b5e75882
package top.ninwoo.utils.util.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import top.ninwoo.utils.util.LinuxCtlUtils;
import top.ninwoo.utils.util.OvsDockerUtils;
......@@ -12,6 +14,7 @@ import top.ninwoo.utils.util.Utils;
*/
@Utils
public class OvsDockerUtilsImpl implements OvsDockerUtils {
private static Logger LOG = LoggerFactory.getLogger(OvsDockerUtilsImpl.class);
@Autowired
LinuxCtlUtils linuxCtlUtils;
......@@ -22,7 +25,8 @@ public class OvsDockerUtilsImpl implements OvsDockerUtils {
+ " " + devName + " " + containerId + " --ipaddress=" + ip;
String res = linuxCtlUtils.runCmd(cmd);
if(res.contains("Error")) {
throw new RuntimeException(res);
LOG.error("创建网络失败", cmd, res);
throw new RuntimeException(cmd + ":" + res);
}
// 这里需要给容器设置mtu
String mtuCmd = "docker exec " + containerId + " ifconfig eth1 mtu 1450";
......
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