kubelet: DRA: remove check to set pluginName to DriverName if not in ResourceHandle
It has always been validated that a ResourceHandle MUST have DriverName set, so this check is unnecessary. Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
		@@ -223,12 +223,6 @@ func (m *ManagerImpl) PrepareResources(pod *v1.Pod) error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			// Loop through all plugins and prepare for calling NodePrepareResources.
 | 
								// Loop through all plugins and prepare for calling NodePrepareResources.
 | 
				
			||||||
			for _, resourceHandle := range claimInfo.ResourceHandles {
 | 
								for _, resourceHandle := range claimInfo.ResourceHandles {
 | 
				
			||||||
				// If no DriverName is provided in the resourceHandle, we
 | 
					 | 
				
			||||||
				// use the DriverName from the status
 | 
					 | 
				
			||||||
				pluginName := claimInfo.DriverName
 | 
					 | 
				
			||||||
				if pluginName == "" {
 | 
					 | 
				
			||||||
					pluginName = claimInfo.DriverName
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				claim := &drapb.Claim{
 | 
									claim := &drapb.Claim{
 | 
				
			||||||
					Namespace:      claimInfo.Namespace,
 | 
										Namespace:      claimInfo.Namespace,
 | 
				
			||||||
					Uid:            string(claimInfo.ClaimUID),
 | 
										Uid:            string(claimInfo.ClaimUID),
 | 
				
			||||||
@@ -238,6 +232,7 @@ func (m *ManagerImpl) PrepareResources(pod *v1.Pod) error {
 | 
				
			|||||||
				if resourceHandle.StructuredData != nil {
 | 
									if resourceHandle.StructuredData != nil {
 | 
				
			||||||
					claim.StructuredResourceHandle = []*resourceapi.StructuredResourceHandle{resourceHandle.StructuredData}
 | 
										claim.StructuredResourceHandle = []*resourceapi.StructuredResourceHandle{resourceHandle.StructuredData}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
									pluginName := resourceHandle.DriverName
 | 
				
			||||||
				batches[pluginName] = append(batches[pluginName], claim)
 | 
									batches[pluginName] = append(batches[pluginName], claim)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -459,13 +454,6 @@ func (m *ManagerImpl) unprepareResources(podUID types.UID, namespace string, cla
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			// Loop through all plugins and prepare for calling NodeUnprepareResources.
 | 
								// Loop through all plugins and prepare for calling NodeUnprepareResources.
 | 
				
			||||||
			for _, resourceHandle := range claimInfo.ResourceHandles {
 | 
								for _, resourceHandle := range claimInfo.ResourceHandles {
 | 
				
			||||||
				// If no DriverName is provided in the resourceHandle, we
 | 
					 | 
				
			||||||
				// use the DriverName from the status
 | 
					 | 
				
			||||||
				pluginName := resourceHandle.DriverName
 | 
					 | 
				
			||||||
				if pluginName == "" {
 | 
					 | 
				
			||||||
					pluginName = claimInfo.DriverName
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				claim := &drapb.Claim{
 | 
									claim := &drapb.Claim{
 | 
				
			||||||
					Namespace:      claimInfo.Namespace,
 | 
										Namespace:      claimInfo.Namespace,
 | 
				
			||||||
					Uid:            string(claimInfo.ClaimUID),
 | 
										Uid:            string(claimInfo.ClaimUID),
 | 
				
			||||||
@@ -475,6 +463,7 @@ func (m *ManagerImpl) unprepareResources(podUID types.UID, namespace string, cla
 | 
				
			|||||||
				if resourceHandle.StructuredData != nil {
 | 
									if resourceHandle.StructuredData != nil {
 | 
				
			||||||
					claim.StructuredResourceHandle = []*resourceapi.StructuredResourceHandle{resourceHandle.StructuredData}
 | 
										claim.StructuredResourceHandle = []*resourceapi.StructuredResourceHandle{resourceHandle.StructuredData}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
									pluginName := resourceHandle.DriverName
 | 
				
			||||||
				batches[pluginName] = append(batches[pluginName], claim)
 | 
									batches[pluginName] = append(batches[pluginName], claim)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user