Commit 5658addb authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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
parents d7fc8d10 fbd13908
...@@ -119,11 +119,18 @@ func (plugin *vsphereVolumePlugin) newUnmounterInternal(volName string, podUID t ...@@ -119,11 +119,18 @@ func (plugin *vsphereVolumePlugin) newUnmounterInternal(volName string, podUID t
} }
func (plugin *vsphereVolumePlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { 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{ vsphereVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: v1.VolumeSource{ VolumeSource: v1.VolumeSource{
VsphereVolume: &v1.VsphereVirtualDiskVolumeSource{ VsphereVolume: &v1.VsphereVirtualDiskVolumeSource{
VolumePath: volumeName, VolumePath: volumePath,
}, },
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment