Skip to content

Conversation

@remos
Copy link

@remos remos commented Jun 30, 2025

Fixes: #2460 by adding /var/run/cdi explicitly as an additional default CDI spec directory

I haven't added a test to compare the default dirs to what's defined in container-device-interface/pkgs/cdi, since that would potentially block dependency updates in the future, though I do wonder if that might be desirable, to catch + allow updating the default and documentation? Though I guess might also just be a chore

I also haven't added any additional tests, and just updated what was already present in pkg/config/config_local_test.go but I'm happy to add + do any additional testing if required/desired, thanks!

Summary by Sourcery

Include /var/run/cdi as a default CDI spec directory and propagate the change through configuration defaults, tests, and documentation.

Enhancements:

  • Add "/var/run/cdi" to the default CDI spec directories

Documentation:

  • Revise documentation and sample containers.conf files to include /var/run/cdi in cdi_spec_dirs

Tests:

  • Update config tests to expect both "/etc/cdi" and "/var/run/cdi"

Fixes: containers#2460

Signed-off-by: Somer Hayter <git@somer.cc>
@sourcery-ai
Copy link

sourcery-ai bot commented Jun 30, 2025

Reviewer's Guide

This PR adds "/var/run/cdi" to the default CDI spec directories by updating the default constant, adjusting tests, and aligning documentation and sample configuration files accordingly.

Class diagram for updated default CDI spec directories

classDiagram
    class Config {
        +[]string DefaultCdiSpecDirs
    }
    Config : DefaultCdiSpecDirs = ["/etc/cdi", "/var/run/cdi"]
Loading

File-Level Changes

Change Details Files
Extend default CDI spec dirs to include /var/run/cdi
  • Append "/var/run/cdi" to DefaultCdiSpecDirs constant
pkg/config/default.go
Update unit tests to expect the expanded default list
  • Modify assertions in Config Local tests to include the new directory
pkg/config/config_local_test.go
Revise man-page documentation for cdi_spec_dirs
  • Add "/var/run/cdi" entry to the default example in the containers.conf man page
docs/containers.conf.5.md
Align sample config files and testdata with the new default
  • Uncomment or update cdi_spec_dirs lists to include the new path in examples and tests
  • Adjust both commented and actual entries in testdata and sample configs
pkg/config/testdata/containers_default.conf
pkg/config/testdata/containers_invalid.conf
pkg/config/testdata/containers_comment.conf
pkg/config/containers.conf

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @remos - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I don't think we need/want a test to compare against the upstream list. If new locations are added we can wait for actual users requesting them and/or manually check for such updates.

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 4, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, Luap99, remos, sourcery-ai[bot]

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 074a6e0 into containers:main Jul 4, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default CDI spec paths doesn't include /var/run/cdi

3 participants