mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Fix some whitespacing and comments in devicemanager
This commit is contained in:
parent
9c41989524
commit
c45f1317eb
@ -658,7 +658,7 @@ func (m *ManagerImpl) devicesToAllocate(podUID, contName, resource string, requi
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
klog.V(3).Infof("Needs to allocate %d %q for pod %q container %q", needed, resource, podUID, contName)
|
klog.V(3).Infof("Needs to allocate %d %q for pod %q container %q", needed, resource, podUID, contName)
|
||||||
// Needs to allocate additional devices.
|
// Check if resource registered with devicemanager
|
||||||
if _, ok := m.healthyDevices[resource]; !ok {
|
if _, ok := m.healthyDevices[resource]; !ok {
|
||||||
return nil, fmt.Errorf("can't allocate unregistered device %s", resource)
|
return nil, fmt.Errorf("can't allocate unregistered device %s", resource)
|
||||||
}
|
}
|
||||||
@ -675,9 +675,10 @@ func (m *ManagerImpl) devicesToAllocate(podUID, contName, resource string, requi
|
|||||||
if m.allocatedDevices[resource] == nil {
|
if m.allocatedDevices[resource] == nil {
|
||||||
m.allocatedDevices[resource] = sets.NewString()
|
m.allocatedDevices[resource] = sets.NewString()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets Devices in use.
|
// Gets Devices in use.
|
||||||
devicesInUse := m.allocatedDevices[resource]
|
devicesInUse := m.allocatedDevices[resource]
|
||||||
// Gets a list of available devices.
|
// Gets Available devices.
|
||||||
available := m.healthyDevices[resource].Difference(devicesInUse)
|
available := m.healthyDevices[resource].Difference(devicesInUse)
|
||||||
if available.Len() < needed {
|
if available.Len() < needed {
|
||||||
return nil, fmt.Errorf("requested number of devices unavailable for %s. Requested: %d, Available: %d", resource, needed, available.Len())
|
return nil, fmt.Errorf("requested number of devices unavailable for %s. Requested: %d, Available: %d", resource, needed, available.Len())
|
||||||
|
Loading…
Reference in New Issue
Block a user