Skip to content
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

many: add cuda-driver-libs interface #15063

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

alfonsosanchezbeato
Copy link
Member

Add cuda-driver-libs interface. This is the first interface using the ldconfig backend. Additionally, it is the first example of an implicit plug, so some changes in ifacestate are also part of this change.

Copy link

github-actions bot commented Feb 11, 2025

Wed Feb 12 20:19:24 UTC 2025
The following results are from: https://github.com/canonical/snapd/actions/runs/13291358349

Failures:

Executing:

  • google-distro-1:debian-11-64:tests/main/progress
  • google-core:ubuntu-core-18-64:tests/core/kernel-base-gadget-single-reboot
  • google:ubuntu-20.04-64:tests/main/lxd:snapd_cgroup_neither
  • google:ubuntu-20.04-64:tests/main/lxd:snapd_cgroup_just_outside
  • google:ubuntu-24.10-64:tests/main/progress
  • google:ubuntu-24.04-64:tests/main/document-interfaces-url

Restoring:

  • openstack:fedora-41-64:tests/main/refresh-all-undo
  • openstack:fedora-41-64:tests/main/
  • openstack:fedora-41-64

Copy link

codecov bot commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 81.35593% with 22 lines in your changes missing coverage. Please review.

Please upload report for BASE (master@c4ff9e7). Learn more about missing BASE report.
Report is 239 commits behind head on master.

Files with missing lines Patch % Lines
interfaces/builtin/cuda_driver_libs.go 86.25% 8 Missing and 3 partials ⚠️
overlord/ifacestate/ifacestate.go 0.00% 2 Missing and 3 partials ⚠️
overlord/ifacestate/handlers.go 0.00% 0 Missing and 4 partials ⚠️
overlord/ifacestate/helpers.go 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #15063   +/-   ##
=========================================
  Coverage          ?   77.98%           
=========================================
  Files             ?     1170           
  Lines             ?   157034           
  Branches          ?        0           
=========================================
  Hits              ?   122467           
  Misses            ?    26963           
  Partials          ?     7604           
Flag Coverage Δ
unittests 77.98% <81.35%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Grow test for interfaces that export libraries to the rootfs, like
cuda-driver-libs.
Make sure that Setup touches the ldconfig configuration only for the
system snap, as it is the owner of it. Otherwise the configuration
would be destroyed when the other snaps are configured.
Copy link
Member

@andrewphelpsj andrewphelpsj left a comment

Choose a reason for hiding this comment

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

Thank you!

if len(fields) != 1 && len(fields) != 3 {
return fmt.Errorf("wrong format for api-version: %q", versRange)
}
switch len(fields) {
Copy link
Member

Choose a reason for hiding this comment

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

A comment here with examples of the expected input might be good. I think something like this?

// valid input examples:
// 1.2.3
// 1.2.3 .. 2.3.4

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I've added a comment

Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

did a first pass, don't we need a configfile part to this?

// For the moment only the system snap is supported - the
// snap.system.conf file is owned by it and the set-up of other snaps
// must not affect it.
if !interfaces.IsTheSystemSnap(appSet.InstanceName()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we discussed before that this doesn't make a lot of sense because of the two of the interface, why is it needed?

Copy link
Member Author

@alfonsosanchezbeato alfonsosanchezbeato Feb 19, 2025

Choose a reason for hiding this comment

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

It is actually needed, otherwise when the slot side builds its profiles after, say, a disconnection, it overrides the content of snap.system.conf. That file is owned by the system plug and no other plug/slot should touch it.

For instance, this is seen when there are 2 snaps providing slots, if one is removed, when reconstructing the slot profiles it sees no spec.libDirs and it removes the file, overriding what the plug profile wrote just before.

Copy link
Collaborator

@pedronis pedronis Feb 19, 2025

Choose a reason for hiding this comment

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

let's talk about this in our 1-1, I'm really worried that these are the only interfaces that need this kind of behavior and they assume things about two levels up in the code from them

}
// Validate directories
for _, dir := range libDirs {
if !strings.HasPrefix(dir, "$SNAP") && !strings.HasPrefix(dir, "${SNAP}") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't this also include the / ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, changed

@pedronis
Copy link
Collaborator

@alfonsosanchezbeato maybe it would make sense to make the changes to support implicit plugs their own PR?

Copy link
Member Author

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

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

@pedronis thanks for the review, comments addressed. Regarding configfile, no, for th cuda interface we do not have configuration files that we need to take care of.

// For the moment only the system snap is supported - the
// snap.system.conf file is owned by it and the set-up of other snaps
// must not affect it.
if !interfaces.IsTheSystemSnap(appSet.InstanceName()) {
Copy link
Member Author

@alfonsosanchezbeato alfonsosanchezbeato Feb 19, 2025

Choose a reason for hiding this comment

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

It is actually needed, otherwise when the slot side builds its profiles after, say, a disconnection, it overrides the content of snap.system.conf. That file is owned by the system plug and no other plug/slot should touch it.

For instance, this is seen when there are 2 snaps providing slots, if one is removed, when reconstructing the slot profiles it sees no spec.libDirs and it removes the file, overriding what the plug profile wrote just before.

}
// Validate directories
for _, dir := range libDirs {
if !strings.HasPrefix(dir, "$SNAP") && !strings.HasPrefix(dir, "${SNAP}") {
Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants