feat: add pcieroot as a device attribute#114
Conversation
|
/cc @aojea |
pkg/inventory/db.go
Outdated
| device.Attributes["dra.net/pciAddressFunction"] = resourceapi.DeviceAttribute{StringValue: &address.function} | ||
| } | ||
| if address.domain != "" && address.bus != "" { | ||
| pcieRoot := fmt.Sprintf("pci%s:%s", address.bus, address.device) |
There was a problem hiding this comment.
have you validate this is the correct format expected by all drivers?
There was a problem hiding this comment.
I'm using the definition from the kep, although I realized I used the wrong values in the sprintf. Good catch!
1. `resource.kubernetes.io/pcieRoot`: A string value in the format
// `pci<domain>:<bus>`, referring to a PCIe (Peripheral Component
// Interconnect Express) Root Complex. This attribute can be used to
// identify devices that share the same PCIe Root Complex. DRA drivers MAY
// determine this value by inspecting the hierarchical path of the device's
// entry in sysfs (e.g., `/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0`),
// where the `pci<domain>:<bus>` segment at the beginning of the real path
// identifies the Root Complex (e.g., `pci0000:00`).
There was a problem hiding this comment.
Based on discussion in kubernetes/kubernetes#132296 this needs some update because the root pci device may have a different hub than the device itself.
There was a problem hiding this comment.
Updated, PTAL again whenever you have a chance!
pkg/inventory/db.go
Outdated
| device.Attributes["dra.net/pciAddressFunction"] = resourceapi.DeviceAttribute{StringValue: &address.function} | ||
| } | ||
| if address.domain != "" && address.bus != "" { | ||
| pcieRoot := fmt.Sprintf("pci%s:%s", address.bus, address.device) |
There was a problem hiding this comment.
I'm using the definition from the kep, although I realized I used the wrong values in the sprintf. Good catch!
1. `resource.kubernetes.io/pcieRoot`: A string value in the format
// `pci<domain>:<bus>`, referring to a PCIe (Peripheral Component
// Interconnect Express) Root Complex. This attribute can be used to
// identify devices that share the same PCIe Root Complex. DRA drivers MAY
// determine this value by inspecting the hierarchical path of the device's
// entry in sysfs (e.g., `/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0`),
// where the `pci<domain>:<bus>` segment at the beginning of the real path
// identifies the Root Complex (e.g., `pci0000:00`).
pkg/inventory/db.go
Outdated
| device.Attributes["dra.net/pciAddressFunction"] = resourceapi.DeviceAttribute{StringValue: &address.function} | ||
| } | ||
| if address.domain != "" && address.bus != "" { | ||
| pcieRoot := fmt.Sprintf("pci%s:%s", address.bus, address.device) |
There was a problem hiding this comment.
Based on discussion in kubernetes/kubernetes#132296 this needs some update because the root pci device may have a different hub than the device itself.
a1d386a to
60ee798
Compare
|
Tested locally, looks like it's working as expected: |
kubernetes/enhancements#5316 provides a standardized device attribute for pcieroot. Use that definition.
|
@gauravkghildiyal please review and once you LGTM I merge |
|
We know need to document how to use this with an example |
kubernetes/enhancements#5316 provides a standardized device attribute for pcieroot. Use that definition. Fixes #111