mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #37167 from luomiao/fix-photon-plugin-ConstructVolumeSpec
Automatic merge from submit-queue Fix photon controller plugin to construct with correct PdID **What this PR does / why we need it**: This PR is to fix a mismatching of unmount path in photon volume plugin, which is resulted from the assigning volume spec name to persistent disk ID. Without this path, unmounting process is stalling in reconciler when a pod is deleted. Restart the same pod will see a mount failure because the previous unmounting is still going on. The input variable of function ConstructVolumeSpec is the volume spec name instead of persistent disk ID. Previously the function directly construct new volume spec by assigning volume spec name to persistent disk ID, which will result in mismatching of mount path. The fix will find the pdID according to mount path and construct volume spec with the correct pdID. I have tested the patch with back-to-back pod creation/deletion and mounting/unmounting of photon persistent disk volume source performs normal now. This need to be cherry-picked to 1.5 release branch.
This commit is contained in:
commit
4c0781e962
@ -119,12 +119,19 @@ func (plugin *photonPersistentDiskPlugin) newUnmounterInternal(volName string, p
|
||||
}}, nil
|
||||
}
|
||||
|
||||
func (plugin *photonPersistentDiskPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
|
||||
func (plugin *photonPersistentDiskPlugin) ConstructVolumeSpec(volumeSpecName, mountPath string) (*volume.Spec, error) {
|
||||
mounter := plugin.host.GetMounter()
|
||||
pluginDir := plugin.host.GetPluginDir(plugin.GetPluginName())
|
||||
pdID, err := mounter.GetDeviceNameFromMount(mountPath, pluginDir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
photonPersistentDisk := &v1.Volume{
|
||||
Name: volumeName,
|
||||
Name: volumeSpecName,
|
||||
VolumeSource: v1.VolumeSource{
|
||||
PhotonPersistentDisk: &v1.PhotonPersistentDiskVolumeSource{
|
||||
PdID: volumeName,
|
||||
PdID: pdID,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user