Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
51169d68
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,发现更多精彩内容 >>
提交
51169d68
编写于
2月 08, 2021
作者:
P
Priya Wadhwa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add context to remaining necessary functions
上级
a6372b35
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
8 deletion
+10
-8
cmd/minikube/cmd/delete.go
cmd/minikube/cmd/delete.go
+5
-4
pkg/drivers/kic/oci/volumes.go
pkg/drivers/kic/oci/volumes.go
+5
-4
未找到文件。
cmd/minikube/cmd/delete.go
浏览文件 @
51169d68
...
...
@@ -110,7 +110,8 @@ func deleteContainersAndVolumes(ociBin string) {
klog
.
Infof
(
"error delete containers by label %q (might be okay): %+v"
,
delLabel
,
errs
)
}
errs
=
oci
.
DeleteAllVolumesByLabel
(
ociBin
,
delLabel
)
ctx
:=
context
.
Background
()
errs
=
oci
.
DeleteAllVolumesByLabel
(
ctx
,
ociBin
,
delLabel
)
if
len
(
errs
)
>
0
{
// it will not error if there is nothing to delete
klog
.
Warningf
(
"error delete volumes by label %q (might be okay): %+v"
,
delLabel
,
errs
)
}
...
...
@@ -120,7 +121,7 @@ func deleteContainersAndVolumes(ociBin string) {
return
}
errs
=
oci
.
PruneAllVolumesByLabel
(
ociBin
,
delLabel
)
errs
=
oci
.
PruneAllVolumesByLabel
(
ctx
,
ociBin
,
delLabel
)
if
len
(
errs
)
>
0
{
// it will not error if there is nothing to delete
klog
.
Warningf
(
"error pruning volumes by label %q (might be okay): %+v"
,
delLabel
,
errs
)
}
...
...
@@ -258,7 +259,7 @@ func deletePossibleKicLeftOver(cname string, driverName string) {
}
}
errs
:=
oci
.
DeleteAllVolumesByLabel
(
bin
,
delLabel
)
errs
:=
oci
.
DeleteAllVolumesByLabel
(
ctx
,
bin
,
delLabel
)
if
errs
!=
nil
{
// it will not error if there is nothing to delete
klog
.
Warningf
(
"error deleting volumes (might be okay).
\n
To see the list of volumes run: 'docker volume ls'
\n
:%v"
,
errs
)
}
...
...
@@ -273,7 +274,7 @@ func deletePossibleKicLeftOver(cname string, driverName string) {
return
}
errs
=
oci
.
PruneAllVolumesByLabel
(
bin
,
delLabel
)
errs
=
oci
.
PruneAllVolumesByLabel
(
ctx
,
bin
,
delLabel
)
if
len
(
errs
)
>
0
{
// it will not error if there is nothing to delete
klog
.
Warningf
(
"error pruning volume (might be okay):
\n
%v"
,
errs
)
}
...
...
pkg/drivers/kic/oci/volumes.go
浏览文件 @
51169d68
...
...
@@ -19,6 +19,7 @@ package oci
import
(
"bufio"
"bytes"
"context"
"fmt"
"os/exec"
"runtime"
...
...
@@ -31,7 +32,7 @@ import (
// DeleteAllVolumesByLabel deletes all volumes that have a specific label
// if there is no volume to delete it will return nil
func
DeleteAllVolumesByLabel
(
ociBin
string
,
label
string
,
warnSlow
...
bool
)
[]
error
{
func
DeleteAllVolumesByLabel
(
ctx
context
.
Context
,
ociBin
string
,
label
string
,
warnSlow
...
bool
)
[]
error
{
var
deleteErrs
[]
error
klog
.
Infof
(
"trying to delete all %s volumes with label %s"
,
ociBin
,
label
)
...
...
@@ -42,7 +43,7 @@ func DeleteAllVolumesByLabel(ociBin string, label string, warnSlow ...bool) []er
}
for
_
,
v
:=
range
vs
{
if
_
,
err
:=
runCmd
(
exec
.
Command
(
ociBin
,
"volume"
,
"rm"
,
"--force"
,
v
),
warnSlow
...
);
err
!=
nil
{
if
_
,
err
:=
runCmd
(
exec
.
Command
Context
(
ctx
,
ociBin
,
"volume"
,
"rm"
,
"--force"
,
v
),
warnSlow
...
);
err
!=
nil
{
deleteErrs
=
append
(
deleteErrs
,
fmt
.
Errorf
(
"deleting %q"
,
v
))
}
}
...
...
@@ -53,10 +54,10 @@ func DeleteAllVolumesByLabel(ociBin string, label string, warnSlow ...bool) []er
// PruneAllVolumesByLabel deletes all volumes that have a specific label
// if there is no volume to delete it will return nil
// example: docker volume prune -f --filter label=name.minikube.sigs.k8s.io=minikube
func
PruneAllVolumesByLabel
(
ociBin
string
,
label
string
,
warnSlow
...
bool
)
[]
error
{
func
PruneAllVolumesByLabel
(
ctx
context
.
Context
,
ociBin
string
,
label
string
,
warnSlow
...
bool
)
[]
error
{
var
deleteErrs
[]
error
klog
.
Infof
(
"trying to prune all %s volumes with label %s"
,
ociBin
,
label
)
cmd
:=
exec
.
Command
(
ociBin
,
"volume"
,
"prune"
,
"-f"
,
"--filter"
,
"label="
+
label
)
cmd
:=
exec
.
Command
Context
(
ctx
,
ociBin
,
"volume"
,
"prune"
,
"-f"
,
"--filter"
,
"label="
+
label
)
if
_
,
err
:=
runCmd
(
cmd
,
warnSlow
...
);
err
!=
nil
{
deleteErrs
=
append
(
deleteErrs
,
errors
.
Wrapf
(
err
,
"prune volume by label %s"
,
label
))
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录