Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
303f059e
Commit
303f059e
authored
May 06, 2016
by
Robert Bailey
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #24817 from pmorie/clarify-orphaned-cleanup
Clarify orphaned volume cleanup
parents
64e12401
11113a00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
kubelet.go
pkg/kubelet/kubelet.go
+7
-6
No files found.
pkg/kubelet/kubelet.go
View file @
303f059e
...
@@ -1981,23 +1981,24 @@ func (kl *Kubelet) cleanupOrphanedVolumes(pods []*api.Pod, runningPods []*kubeco
...
@@ -1981,23 +1981,24 @@ func (kl *Kubelet) cleanupOrphanedVolumes(pods []*api.Pod, runningPods []*kubeco
if
_
,
ok
:=
desiredVolumes
[
name
];
!
ok
{
if
_
,
ok
:=
desiredVolumes
[
name
];
!
ok
{
parts
:=
strings
.
Split
(
name
,
"/"
)
parts
:=
strings
.
Split
(
name
,
"/"
)
if
runningSet
.
Has
(
parts
[
0
])
{
if
runningSet
.
Has
(
parts
[
0
])
{
glog
.
Infof
(
"volume %q, still has a container running
%q
, skipping teardown"
,
name
,
parts
[
0
])
glog
.
Infof
(
"volume %q, still has a container running
(%q)
, skipping teardown"
,
name
,
parts
[
0
])
continue
continue
}
}
//TODO (jonesdl) We should somehow differentiate between volumes that are supposed
//TODO (jonesdl) We should somehow differentiate between volumes that are supposed
//to be deleted and volumes that are leftover after a crash.
//to be deleted and volumes that are leftover after a crash.
glog
.
Warning
f
(
"Orphaned volume %q found, tearing down volume"
,
name
)
glog
.
V
(
3
)
.
Info
f
(
"Orphaned volume %q found, tearing down volume"
,
name
)
// TODO(yifan): Refactor this hacky string manipulation.
// TODO(yifan): Refactor this hacky string manipulation.
kl
.
volumeManager
.
DeleteVolumes
(
types
.
UID
(
parts
[
0
]))
kl
.
volumeManager
.
DeleteVolumes
(
types
.
UID
(
parts
[
0
]))
// Get path reference count
// Get path reference count
refs
,
err
:=
mount
.
GetMountRefs
(
kl
.
mounter
,
cleaner
.
Unmounter
.
GetPath
())
volumePath
:=
cleaner
.
Unmounter
.
GetPath
()
refs
,
err
:=
mount
.
GetMountRefs
(
kl
.
mounter
,
volumePath
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Could not get mount path references %v"
,
err
)
glog
.
Errorf
(
"Could not get mount path references for %q: %v"
,
volumePath
,
err
)
}
}
//TODO (jonesdl) This should not block other kubelet synchronization procedures
//TODO (jonesdl) This should not block other kubelet synchronization procedures
err
=
cleaner
.
Unmounter
.
TearDown
()
err
=
cleaner
.
Unmounter
.
TearDown
()
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Could not tear down volume %q
: %v"
,
name
,
err
)
glog
.
Errorf
(
"Could not tear down volume %q
at %q: %v"
,
name
,
volumePath
,
err
)
}
}
// volume is unmounted. some volumes also require detachment from the node.
// volume is unmounted. some volumes also require detachment from the node.
...
@@ -2005,7 +2006,7 @@ func (kl *Kubelet) cleanupOrphanedVolumes(pods []*api.Pod, runningPods []*kubeco
...
@@ -2005,7 +2006,7 @@ func (kl *Kubelet) cleanupOrphanedVolumes(pods []*api.Pod, runningPods []*kubeco
detacher
:=
*
cleaner
.
Detacher
detacher
:=
*
cleaner
.
Detacher
err
=
detacher
.
Detach
()
err
=
detacher
.
Detach
()
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Could not detach volume %q
: %v"
,
name
,
err
)
glog
.
Errorf
(
"Could not detach volume %q
at %q: %v"
,
name
,
volumePath
,
err
)
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment