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

Fix info --resources for wwan devices #12281

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

skatsaounis
Copy link
Contributor

@skatsaounis skatsaounis commented Sep 20, 2023

This PR recursively expands the device directory path of sys/class/net devices by appending /device until the it finds a device regular file as a child.

This is needed for devices like wwan which include sub-devices and they differ from typical sys/class/net devices. For such kind of devices, the net info is present at the top ./device directory but rest information needed to fill Card struct is located at ./device/device.

Please take a look below for more info:

# ll --time-style='+' /sys/class/net/wwan0/device/
total 0
drwxr-xr-x 7 root root    0  ./
drwxr-xr-x 3 root root    0  ../
lrwxrwxrwx 1 root root    0  device -> ../../../0000:08:00.0/
-r--r--r-- 1 root root 4096  index
drwxr-xr-x 3 root root    0  net/
drwxr-xr-x 2 root root    0  power/
lrwxrwxrwx 1 root root    0  subsystem -> ../../../../../../class/wwan/
-rw-r--r-- 1 root root 4096  uevent
drwxr-xr-x 3 root root    0  wwan0at0/
drwxr-xr-x 3 root root    0  wwan0at1/
drwxr-xr-x 3 root root    0  wwan0mbim0/

# ll --time-style='+' /sys/class/net/wwan0/device/device/
...
-r--r--r--  1 root root 4096  device
...
lrwxrwxrwx  1 root root    0  driver -> ../../../../bus/pci/drivers/iosm/
...
-rw-r--r--  1 root root 4096  numa_node
...
-r--r--r--  1 root root 4096  vendor
...

Fixes #12153

@skatsaounis skatsaounis changed the title Fix info --resources for wwan devices [WIP] Fix info --resources for wwan devices Sep 20, 2023
@skatsaounis skatsaounis marked this pull request as draft September 20, 2023 13:24
@skatsaounis skatsaounis force-pushed the fix-wwan-devices-info branch 2 times, most recently from b081da7 to ccbc667 Compare September 21, 2023 05:55
@skatsaounis skatsaounis marked this pull request as ready for review September 21, 2023 06:41
@skatsaounis skatsaounis changed the title [WIP] Fix info --resources for wwan devices Fix info --resources for wwan devices Sep 21, 2023
@skatsaounis skatsaounis force-pushed the fix-wwan-devices-info branch 2 times, most recently from 378b628 to 5032211 Compare September 21, 2023 08:16
@skatsaounis skatsaounis marked this pull request as draft September 21, 2023 09:44
@tomponline
Copy link
Member

@skatsaounis did you want a review of this? If so please can you mark it as ready for review. Thanks :)

@skatsaounis skatsaounis marked this pull request as ready for review September 28, 2023 04:22
@skatsaounis
Copy link
Contributor Author

@tomponline PR is ready for review. Please take a look :)

@skatsaounis
Copy link
Contributor Author

Before change:

$ lxc info --resources
Error: Failed to retrieve network information: Failed to add device information for "/sys/class/net/wwan0/device": Failed to read "/sys/class/net/wwan0/device/device": read /sys/class/net/wwan0/device/device: is a directory

After the change:

$ lxc info --resources
...
NICs:
...
  Card 1:
    NUMA node: 0
    Vendor: Intel Corporation (8086)
    PCI address: 0000:08:00.0
    Driver: iosm (6.2.0-33-generic)
...

Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

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

Please can you update the PR description with what has changed in this PR so I can understand and review. Thanks

Signed-off-by: Stamatis Katsaounis <stamatis.katsaounis@canonical.com>
@skatsaounis
Copy link
Contributor Author

Comments and descriptions have been added

Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

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

Thanks!

@tomponline tomponline merged commit cfda2b7 into canonical:main Sep 29, 2023
26 checks passed
@skatsaounis skatsaounis deleted the fix-wwan-devices-info branch September 29, 2023 09:26
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.

LXD 5.15 fails to determine resources
2 participants