-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support CDI devices in --device flag #4084
Conversation
36315ee
to
894571d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulling in nearly 40,000 lines of vendored code just to use cdi.IsQualifiedName
is unlikely to be acceptable. Go is fairly good at only vendoring the parts of the package graph which are reachable from the main module, so splitting the name parsing logic from github.com/container-orchestrated-devices/container-device-interface/pkg/cdi
into a separate package (within the same module) might be sufficient to cut out the unnecessary vendoring.
Yes, there have been discussions in the COD working group regarding better handling CDI dependencies. I will chat to @klihub as well to see whether we can get something done for this. Update: I have created cncf-tags/container-device-interface#130 to move the device name validation to a separate package. |
04ae2be
to
56e37d6
Compare
@corhere thanks for the suggestion with regards to reworking the package upstream. I have reorganised it and the dependencies that are now pulled in are more limited. |
The PR to add CDI support to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little apprehensive to shove this into the existing --device
flag due to past issues with the-v
flag....
But if it works it works and I don't want to hold it up since even technically -v
works with all the things we've overloaded it with... so LGTM.
We'll have a look at this; want to have a quick check with some other people on the UX 👍 |
Thanks @thaJeztah and others for the review. If there are UX changes required, please let us know. Note that we currently have the same support in Podman, Singularity, and CTR and it would be good to have the same UX across all CLI clients so that we don't end up in the situation we have now with the With these changes the
From my perspective, the risk for ambiguity across these three cases is low and is outweighed by the simplicity of the UX in reasoning about devices. That is to say, users are used to using the |
@thaJeztah has there been any feedback on possible UX issues? |
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
@corhere @cpuguy83 @neersighted @thaJeztah I've updated the vendoring again. PTAL. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #4084 +/- ##
==========================================
+ Coverage 59.38% 59.39% +0.01%
==========================================
Files 288 288
Lines 24749 24761 +12
==========================================
+ Hits 14696 14708 +12
Misses 9169 9169
Partials 884 884 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, sorry for the delay!
- What I did
Added support for specifying CDI devices in the
--device
flag. See #3864Note that support for specifying CDI devices in the
--device
flag has been merged into Podman, Singularity (OCI mode), and Containerd'sctr
command.All of these rely on the fact that fully-qualified CDI devices names provide a unique mechanism to identify these devices names which does not conflict with devices nodes on Linux systems or devices identifiers on Windows systems.
- How I did it
Before performing the platform-specific validation and parsing of the
--device
arguments, the specified device is checked to see whether it is a fully-qualified device name of the form:vendor.com/class=name
. If this is the case, it is considered a CDI device.A device request (similar to the
--gpus
flag) is constructed from the specified CDI device names and added to theHostConfig
to be passed to the API. This requires moby/moby#45134 to be regognized and processed properly by the daemon.- How to verify it
Prerequisites:
Create a CDI specification for testing:
Copy the generated spec to
/var/run/cdi
:Run the docker CLI requesting the device:
Running with an undefined cdi device name shows:
If the daemon does not support CDI (e.g. is in experimental mode), the following will be shown:
- Description for the changelog
Add support for requesting CDI devices using the
--device
flag will show an error indicating a missingcdi
driver.- A picture of a cute animal (not mandatory but encouraged)