Merge pull request #13293 from yujuhong/pod_dir

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2015-09-01 04:59:55 -07:00
commit 5331a26c5b

View File

@ -1380,12 +1380,20 @@ func (kl *Kubelet) cleanupOrphanedPodDirs(pods []*api.Pod, runningPods []*kubeco
return err return err
} }
errlist := []error{} errlist := []error{}
for i := range found { for _, uid := range found {
if !active.Has(string(found[i])) { if active.Has(string(uid)) {
glog.V(3).Infof("Orphaned pod %q found, removing", found[i]) continue
if err := os.RemoveAll(kl.getPodDir(found[i])); err != nil { }
errlist = append(errlist, err) if err := os.Remove(kl.getPodVolumesDir(uid)); err != nil {
} // If we cannot remove the volumes directory, it implies that the
// the directory is not empty. We should wait for the volume
// cleanup to complete before attempting to delete the directory.
glog.V(3).Infof("Orphaned pod %q found, but unable to remove the volume directory", uid)
continue
}
glog.V(3).Infof("Orphaned pod %q found, removing", uid)
if err := os.RemoveAll(kl.getPodDir(uid)); err != nil {
errlist = append(errlist, err)
} }
} }
return utilErrors.NewAggregate(errlist) return utilErrors.NewAggregate(errlist)