|
@@ -30,6 +30,17 @@ func (daemon *Daemon) handleDevice(req container.DeviceRequest, spec *specs.Spec
|
|
|
}
|
|
|
}
|
|
|
} else if dd := deviceDrivers[req.Driver]; dd != nil {
|
|
|
+ // We add a special case for the CDI driver here as the cdi driver does
|
|
|
+ // not distinguish between capabilities.
|
|
|
+ // Furthermore, the "OR" and "AND" matching logic for the capability
|
|
|
+ // sets requires that a dummy capability be specified when constructing a
|
|
|
+ // DeviceRequest.
|
|
|
+ // This workaround can be removed once these device driver are
|
|
|
+ // refactored to be plugins, with each driver implementing its own
|
|
|
+ // matching logic, for example.
|
|
|
+ if req.Driver == "cdi" {
|
|
|
+ return dd.updateSpec(spec, &deviceInstance{req: req})
|
|
|
+ }
|
|
|
if selected := dd.capset.Match(req.Capabilities); selected != nil {
|
|
|
return dd.updateSpec(spec, &deviceInstance{req: req, selectedCaps: selected})
|
|
|
}
|