Move the check for permanent device plugins to list creation
Instead of always adding them to the list and then ignoring
them later
@@ -128,8 +128,11 @@ func (c *DeviceController) updatePermittedHostDevicePlugins() (map[string]Contro
if hostDevs := c.virtConfig.GetPermittedHostDevices(); hostDevs != nil {
// generate a map of currently started device plugins
for resourceName, hostDevDP := range c.devicePlugins {
+ _, isPermanent := permanentDevicePluginPaths[resourceName]
+ if !isPermanent {
devicePluginsToStop[resourceName] = hostDevDP
}
+ }
supportedPCIDeviceMap := make(map[string]string)
if len(hostDevs.PciHostDevices) != 0 {
for _, pciDev := range hostDevs.PciHostDevices {
@@ -211,12 +214,10 @@ func (c *DeviceController) refreshPermittedDevices() error {
}
// remove device plugin for now forbidden devices
for resourceName, dev := range disabledDevicePlugins {
- if _, isStaticResource := permanentDevicePluginPaths[resourceName]; !isStaticResource {
close(dev.stopChan)
delete(c.devicePlugins, resourceName)
debugDevRemoved = append(debugDevRemoved, resourceName)
}
- }
c.devicePluginsMutex.Unlock()
