mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #42250 from justinsb/volumes_getnodeandvolume_comment
Automatic merge from submit-queue volumes: add comment on getNodeAndVolume Add comments on getNodeAndVolume to explain the code - it is a little subtle, and it confused me on first reading. Part of #40583 ```release-note NONE ```
This commit is contained in:
		@@ -412,6 +412,13 @@ func (asw *actualStateOfWorld) SetDetachRequestTime(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Get the volume and node object from actual state of world
 | 
					// Get the volume and node object from actual state of world
 | 
				
			||||||
// This is an internal function and caller should acquire and release the lock
 | 
					// This is an internal function and caller should acquire and release the lock
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Note that this returns disconnected objects, so if you change the volume object you must set it back with
 | 
				
			||||||
 | 
					// `asw.attachedVolumes[volumeName]=volumeObj`.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// If you change the node object you must use `volumeObj.nodesAttachedTo[nodeName] = nodeObj`
 | 
				
			||||||
 | 
					// This is correct, because if volumeObj is empty this function returns an error, and nodesAttachedTo
 | 
				
			||||||
 | 
					// map is a reference type, and thus mutating the copy changes the original map.
 | 
				
			||||||
func (asw *actualStateOfWorld) getNodeAndVolume(
 | 
					func (asw *actualStateOfWorld) getNodeAndVolume(
 | 
				
			||||||
	volumeName v1.UniqueVolumeName, nodeName types.NodeName) (attachedVolume, nodeAttachedTo, error) {
 | 
						volumeName v1.UniqueVolumeName, nodeName types.NodeName) (attachedVolume, nodeAttachedTo, error) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user