Merge pull request #24545 from swagiaal/rename-cleaner-tuple

Automatic merge from submit-queue

Rename cleanerTuple to cleaner

Rename cleanerTuple to cleaner.
This is a follow up to address: https://github.com/kubernetes/kubernetes/pull/19503#discussion_r49538769

@saad-ali
This commit is contained in:
k8s-merge-robot 2016-04-27 09:51:26 -07:00
commit 7e430f543b
2 changed files with 11 additions and 11 deletions

View File

@ -1983,7 +1983,7 @@ func (kl *Kubelet) cleanupOrphanedVolumes(pods []*api.Pod, runningPods []*kubeco
runningSet.Insert(string(pod.ID))
}
for name, cleanerTuple := range currentVolumes {
for name, cleaner := range currentVolumes {
if _, ok := desiredVolumes[name]; !ok {
parts := strings.Split(name, "/")
if runningSet.Has(parts[0]) {
@ -1996,19 +1996,19 @@ func (kl *Kubelet) cleanupOrphanedVolumes(pods []*api.Pod, runningPods []*kubeco
// TODO(yifan): Refactor this hacky string manipulation.
kl.volumeManager.DeleteVolumes(types.UID(parts[0]))
// Get path reference count
refs, err := mount.GetMountRefs(kl.mounter, cleanerTuple.Unmounter.GetPath())
refs, err := mount.GetMountRefs(kl.mounter, cleaner.Unmounter.GetPath())
if err != nil {
return fmt.Errorf("Could not get mount path references %v", err)
}
//TODO (jonesdl) This should not block other kubelet synchronization procedures
err = cleanerTuple.Unmounter.TearDown()
err = cleaner.Unmounter.TearDown()
if err != nil {
glog.Errorf("Could not tear down volume %q: %v", name, err)
}
// volume is unmounted. some volumes also require detachment from the node.
if cleanerTuple.Detacher != nil && len(refs) == 1 {
detacher := *cleanerTuple.Detacher
if cleaner.Detacher != nil && len(refs) == 1 {
detacher := *cleaner.Detacher
err = detacher.Detach()
if err != nil {
glog.Errorf("Could not detach volume %q: %v", name, err)

View File

@ -207,9 +207,9 @@ func (kl *Kubelet) getPodVolumes(podUID types.UID) ([]*volumeTuple, error) {
return volumes, nil
}
// cleanerTuple is a union struct to allow separating detaching from the cleaner.
// cleaner is a union struct to allow separating detaching from the cleaner.
// some volumes require detachment but not all. Unmounter cannot be nil but Detacher is optional.
type cleanerTuple struct {
type cleaner struct {
Unmounter volume.Unmounter
Detacher *volume.Detacher
}
@ -217,12 +217,12 @@ type cleanerTuple struct {
// getPodVolumesFromDisk examines directory structure to determine volumes that
// are presently active and mounted. Returns a union struct containing a volume.Unmounter
// and potentially a volume.Detacher.
func (kl *Kubelet) getPodVolumesFromDisk() map[string]cleanerTuple {
currentVolumes := make(map[string]cleanerTuple)
func (kl *Kubelet) getPodVolumesFromDisk() map[string]cleaner {
currentVolumes := make(map[string]cleaner)
podUIDs, err := kl.listPodsFromDisk()
if err != nil {
glog.Errorf("Could not get pods from disk: %v", err)
return map[string]cleanerTuple{}
return map[string]cleaner{}
}
// Find the volumes for each on-disk pod.
for _, podUID := range podUIDs {
@ -245,7 +245,7 @@ func (kl *Kubelet) getPodVolumesFromDisk() map[string]cleanerTuple {
continue
}
tuple := cleanerTuple{Unmounter: unmounter}
tuple := cleaner{Unmounter: unmounter}
detacher, err := kl.newVolumeDetacherFromPlugins(volume.Kind, volume.Name, podUID)
// plugin can be nil but a non-nil error is a legitimate error
if err != nil {