Merge pull request #37413 from vmware/FixUnmountVolume

Automatic merge from submit-queue

kubernetes attempts to unmount a wrong vSphere volume and stops making any progress after that

This is in reference to the bug #37332 which was accidentally closed. So created this new PR.

The code is already reviewed as part of PR #37332 

Fixes issue #37022 

@saad-ali @jingxu97 @abrarshivani @kerneltime
This commit is contained in:
Kubernetes Submit Queue 2016-11-30 23:26:06 -08:00 committed by GitHub
commit 5658addb9b

View File

@ -119,11 +119,18 @@ func (plugin *vsphereVolumePlugin) newUnmounterInternal(volName string, podUID t
}
func (plugin *vsphereVolumePlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
mounter := plugin.host.GetMounter()
pluginDir := plugin.host.GetPluginDir(plugin.GetPluginName())
volumePath, err := mounter.GetDeviceNameFromMount(mountPath, pluginDir)
if err != nil {
return nil, err
}
glog.V(5).Infof("vSphere volume path is %q", volumePath)
vsphereVolume := &v1.Volume{
Name: volumeName,
VolumeSource: v1.VolumeSource{
VsphereVolume: &v1.VsphereVirtualDiskVolumeSource{
VolumePath: volumeName,
VolumePath: volumePath,
},
},
}