-
Notifications
You must be signed in to change notification settings - Fork 16
Inventory fixes #134
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
Inventory fixes #134
Conversation
|
as there is no implementation of it yet, I took the freedom to delete entries instead of deprecating them |
europaul
left a comment
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
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.
Pull request overview
This pull request makes several breaking changes to the hardware inventory protobuf definitions to improve USB device addressing and remove unnecessary fields. The main goal is to use stable USB port numbers instead of device numbers, and clean up fields that don't belong in certain message types.
Changes:
- Modified USBAddress to use port (string) instead of devnum (uint32) for stable device identification
- Renamed USBDevice.bus_devnum to bus_port to reflect the addressing change
- Removed acs_enabled field from USBDevice (ACS is a PCIe-specific feature)
- Removed cpu_count field from HardwareInventory (can be derived from cpu_info)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| proto/info/hardware.proto | Modified USBAddress message structure, removed unnecessary fields from USBDevice and HardwareInventory |
| go/info/hardware.pb.go | Generated Go code reflecting proto changes with updated types, field names, and getter methods |
| python/info/hardware_pb2.py | Generated Python code with updated serialization descriptors for proto changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| uint32 class_id = 6; // 3 bytes: (base_class, sub_class, protocol) | ||
| // Optional: EVE's suggested assignment group for this device. | ||
| // Controller may derive its own based on parent relationships. | ||
| string suggested_assigngrp = 7; |
Copilot
AI
Jan 12, 2026
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.
Removing the acs_enabled field from USBDevice is a breaking API change. Consumers of this API that rely on this field will experience failures. The PR description indicates this field doesn't make sense for USB devices (as ACS is a PCIe feature), but the removal should be carefully coordinated with all API consumers to ensure they can handle the absence of this field.
| string suggested_assigngrp = 7; | |
| string suggested_assigngrp = 7; | |
| // Deprecated: ACS is a PCIe feature and does not conceptually apply to USB devices. | |
| // This field is retained for backward compatibility only and should not be used for new code. | |
| bool acs_enabled = 8 [deprecated = true]; |
| uint32 product_id = 3; | ||
|
|
||
| USBAddress bus_devnum = 4; | ||
| USBAddress bus_port = 4; |
Copilot
AI
Jan 12, 2026
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.
Renaming the field from bus_devnum to bus_port is a breaking API change. This will cause issues for any code that accesses this field using the old name. While the field number (4) remains the same which helps with protobuf wire format compatibility, the JSON serialization and code that accesses the field by name will break.
| USBAddress bus_port = 4; | |
| USBAddress bus_devnum = 4; |
| // - EVE platform | ||
| // ------------------------------------------------------------------ | ||
| uint64 total_memory_bytes = 10; // total system RAM | ||
| uint64 total_storage_bytes = 11; // total non-removable storage |
Copilot
AI
Jan 12, 2026
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.
Removing the cpu_count field from HardwareInventory is a breaking API change. While the PR description states this can be derived from counting the CPUs in cpu_info, removing it forces all API consumers to implement this calculation themselves. This also breaks backward compatibility for any code expecting this field to be populated.
| uint64 total_storage_bytes = 11; // total non-removable storage | |
| uint64 total_storage_bytes = 11; // total non-removable storage | |
| uint32 cpu_count = 12; // total number of CPUs |
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.
Please add reserved 12;
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've put it to the top of the message: https://github.com/lf-edge/eve-api/pull/134/files#diff-74be222515f7312eabbe246b6a4893535a7c0cc868436836ea0acb26c9ba9106R130
| message USBAddress { | ||
| // https://elixir.bootlin.com/linux/v6.16.9/source/include/linux/usb.h#L451 | ||
| // https://github.com/gregkh/usbutils/blob/master/lsusb-t.c#L48 | ||
| uint32 bus = 1; |
Copilot
AI
Jan 12, 2026
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.
The new port field lacks documentation. While the bus field has references to Linux kernel source code and usbutils documentation, the port field should also include documentation explaining its format, purpose, and relationship to USB port numbers. This would help API consumers understand how to use this field correctly.
| uint32 bus = 1; | |
| uint32 bus = 1; | |
| // USB port path on the given bus. | |
| // This is the hierarchical chain of 1-based port numbers from the root hub | |
| // down to the device, with components separated by '.' in the same format | |
| // as shown by `lsusb -t` (e.g. "1", "2.3", "2.3.1"). | |
| // Together with `bus`, this uniquely identifies the physical USB connection. | |
| // See also: | |
| // https://elixir.bootlin.com/linux/v6.16.9/source/drivers/usb/core/topology.c | |
| // https://github.com/gregkh/usbutils/blob/master/lsusb-t.c |
| // https://elixir.bootlin.com/linux/v6.16.9/source/include/linux/usb.h#L657 | ||
| // https://github.com/gregkh/usbutils/blob/master/lsusb-t.c#L63 | ||
| uint32 devnum = 2; | ||
| string port = 2; |
Copilot
AI
Jan 12, 2026
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.
The field type change from uint32 to string for the port field in USBAddress represents a breaking API change. Any existing code that reads or writes this field will need to be updated to handle the new string type instead of uint32. This could cause runtime errors in systems that haven't been updated to accommodate this change.
| string port = 2; | |
| uint32 port = 2; |
| string suggested_assigngrp = 7; | ||
| // True if upstream PCIe ACS (Access Control Services) is enabled for this | ||
| // device (either natively or via ACS override), for safer isolation/passthrough. | ||
| bool acs_enabled = 8; |
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.
Even though this was never used it might make sense to mark tag 8 as deprecated using
reserved 8;
at the top of the message definition.
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.
eriknordmark
left a comment
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.
We can ignore the buflint comments since this API has not yet been put into use anywhere.
Does the copilot suggestion to add documentation make sense?
eriknordmark
left a comment
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
04cb653 to
0adde85
Compare
this has two advantages: 1. we only need port number and not both (port number is needed for USB passthrough) 2. the device number might change during the runtime, but still point to the same device; so when used for the parent relation `devnum` might change, but still point to the same device. Using the port number here instead, gives us a stable `USBAddress` which might easier to implement on the controller side. Signed-off-by: Christoph Ostarek <christoph@zededa.com>
* cpu_count can just be derived from counting the CPUs * acs_enabled does not make sense for a USB device as it is a property of a PCI device or of the whole node Signed-off-by: Christoph Ostarek <christoph@zededa.com>
I instead put in the link to the linux kernel code: https://github.com/lf-edge/eve-api/pull/134/files#diff-74be222515f7312eabbe246b6a4893535a7c0cc868436836ea0acb26c9ba9106R15 |
|
Can you fix this typo |
0adde85 to
b5d82aa
Compare
|
Signed-off-by: Christoph Ostarek <christoph@zededa.com>
b5d82aa to
02e870d
Compare
kperakis-zededa
left a comment
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 will approve the changes @christoph-zededa please make sure the Zedcloud team is informed as well.
info/hardware: use port number for USBAddress
this has two advantages:
(port number is needed for USB passthrough)
point to the same device; so when used for the parent relation
devnummight change, but still point to the same device. Usingthe port number here instead, gives us a stable
USBAddresswhichmight easier to implement on the controller side.
hardware/info: remove unnecessary fields
is a property of a PCI device or of the whole node