mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
fix GetVolumeInUse() function
Since we just want to get volume name info, each volume name just need to added once. desiredStateOfWorld.GetVolumesToMount() will return volume and pod binding info, if one volume is mounted to several pods, the volume name will be return several times. That is not what we want in this function. We can add a new function to only get the volume name info or judge whether the volume name is added to the desiredVolumesMap array.
This commit is contained in:
parent
76dfee04f5
commit
3bb75064fb
@ -297,8 +297,10 @@ func (vm *volumeManager) GetVolumesInUse() []v1.UniqueVolumeName {
|
||||
|
||||
for _, volume := range desiredVolumes {
|
||||
if volume.PluginIsAttachable {
|
||||
desiredVolumesMap[volume.VolumeName] = true
|
||||
volumesToReportInUse = append(volumesToReportInUse, volume.VolumeName)
|
||||
if _, exists := desiredVolumesMap[volume.VolumeName]; !exists {
|
||||
desiredVolumesMap[volume.VolumeName] = true
|
||||
volumesToReportInUse = append(volumesToReportInUse, volume.VolumeName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user