File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -45,19 +45,29 @@ func (d *directories) Run() error {
45
45
}
46
46
47
47
var dataDirMounted bool
48
+ allKubeletsUnmounted := true
48
49
49
50
// search and unmount kubelet volume mounts
50
51
for _ , v := range procMounts {
51
52
if v .Path == filepath .Join (d .Config .dataDir , "kubelet" ) {
52
53
logrus .Debugf ("%v is mounted! attempting to unmount..." , v .Path )
53
54
if err = mounter .Unmount (v .Path ); err != nil {
55
+ allKubeletsUnmounted = false
54
56
logrus .Warningf ("failed to unmount %v" , v .Path )
55
57
}
56
58
} else if v .Path == d .Config .dataDir {
57
59
dataDirMounted = true
58
60
}
59
61
}
60
62
63
+ if ! allKubeletsUnmounted {
64
+ if dataDirMounted {
65
+ return fmt .Errorf ("unable to remove the contents of mounted data-dir (%s) as not all mounts could be unmounted" , d .Config .dataDir )
66
+ } else {
67
+ return fmt .Errorf ("unable to remove k0s generated data-dir (%s) as not all mounts could be unmounted" , d .Config .dataDir )
68
+ }
69
+ }
70
+
61
71
if dataDirMounted {
62
72
logrus .Debugf ("removing the contents of mounted data-dir (%s)" , d .Config .dataDir )
63
73
} else {
You can’t perform that action at this time.
0 commit comments