Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
8ebc828e
M
minikube
项目概览
Chu Peng 楚鹏
/
minikube
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
minikube
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8ebc828e
编写于
11月 09, 2020
作者:
P
Predrag Rogic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix minikube-net network failures for KVM driver
上级
16f9b261
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
9 deletion
+30
-9
pkg/drivers/kvm/kvm.go
pkg/drivers/kvm/kvm.go
+0
-8
pkg/drivers/kvm/network.go
pkg/drivers/kvm/network.go
+30
-1
未找到文件。
pkg/drivers/kvm/kvm.go
浏览文件 @
8ebc828e
...
...
@@ -240,14 +240,6 @@ func (d *Driver) Restart() error {
// Start a host
func
(
d
*
Driver
)
Start
()
(
err
error
)
{
// if somebody/something deleted the network in the meantime,
// we might need to recreate it. It's (nearly) a noop if the network exists.
log
.
Info
(
"Creating network..."
)
err
=
d
.
createNetwork
()
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"creating network"
)
}
// this call ensures that all networks are active
log
.
Info
(
"Ensuring networks are active..."
)
err
=
d
.
ensureNetwork
()
...
...
pkg/drivers/kvm/network.go
浏览文件 @
8ebc828e
...
...
@@ -26,6 +26,7 @@ import (
"io/ioutil"
"strings"
"text/template"
"time"
"github.com/docker/machine/libmachine/log"
libvirt
"github.com/libvirt/libvirt-go"
...
...
@@ -46,6 +47,9 @@ const networkTmpl = `
</network>
`
// waiting time for libvirt ops to settle
const
nap
=
100
*
time
.
Microsecond
// setupNetwork ensures that the network with `name` is started (active)
// and has the autostart feature set.
func
setupNetwork
(
conn
*
libvirt
.
Connect
,
name
string
)
error
{
...
...
@@ -99,8 +103,24 @@ func (d *Driver) ensureNetwork() error {
// Start the private network
log
.
Infof
(
"Ensuring network %s is active"
,
d
.
PrivateNetwork
)
// retry once to recreate the network, but only if is not used by another minikube instance
if
err
:=
setupNetwork
(
conn
,
d
.
PrivateNetwork
);
err
!=
nil
{
return
err
log
.
Debugf
(
"Network %s is inoperable, will try to recreate it: %v"
,
d
.
PrivateNetwork
,
err
)
if
err
:=
d
.
deleteNetwork
();
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"deleting inoperable network %s"
,
d
.
PrivateNetwork
)
}
log
.
Debugf
(
"Successfully deleted %s network"
,
d
.
PrivateNetwork
)
time
.
Sleep
(
nap
)
if
err
:=
d
.
createNetwork
();
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"recreating inoperable network %s"
,
d
.
PrivateNetwork
)
}
log
.
Debugf
(
"Successfully recreated %s network"
,
d
.
PrivateNetwork
)
time
.
Sleep
(
nap
)
if
err
:=
setupNetwork
(
conn
,
d
.
PrivateNetwork
);
err
!=
nil
{
return
err
}
log
.
Debugf
(
"Successfully activated %s network"
,
d
.
PrivateNetwork
)
time
.
Sleep
(
nap
)
}
return
nil
...
...
@@ -179,15 +199,24 @@ func (d *Driver) deleteNetwork() error {
// when we reach this point, it means it is safe to delete the network
log
.
Debugf
(
"Trying to destroy network %s..."
,
d
.
PrivateNetwork
)
// cannot destroy an inactive network - try to activate it first
active
,
err
:=
network
.
IsActive
()
if
err
==
nil
&&
!
active
{
log
.
Debugf
(
"Trying to reactivate network %s first..."
,
d
.
PrivateNetwork
)
_
=
network
.
Create
()
time
.
Sleep
(
nap
)
}
err
=
network
.
Destroy
()
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"network destroy"
)
}
time
.
Sleep
(
nap
)
log
.
Debugf
(
"Trying to undefine network %s..."
,
d
.
PrivateNetwork
)
err
=
network
.
Undefine
()
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"network undefine"
)
}
time
.
Sleep
(
nap
)
return
nil
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录