-
Notifications
You must be signed in to change notification settings - Fork 183
domainmgr: match device ports by PCI, not just interface name #6169
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,12 @@ func (m *DpcManager) updateDNS() { | |
| m.deviceNetStatus.Ports[ix].IfName = port.IfName | ||
| m.deviceNetStatus.Ports[ix].Phylabel = port.Phylabel | ||
| m.deviceNetStatus.Ports[ix].Logicallabel = port.Logicallabel | ||
| // Record the PCI address backing this port so consumers (e.g. domainmgr | ||
| // deciding whether to reserve a device to pciback) can match a port to | ||
| // a physical device by stable PCI identity rather than by the | ||
| // kernel-assigned interface name. Seed from the config; the live value | ||
| // resolved from the interface below takes precedence when available. | ||
| m.deviceNetStatus.Ports[ix].PciLong = port.PCIAddr | ||
| m.deviceNetStatus.Ports[ix].SharedLabels = port.SharedLabels | ||
| m.deviceNetStatus.Ports[ix].Alias = port.Alias | ||
| m.deviceNetStatus.Ports[ix].IsMgmt = port.IsMgmt | ||
|
|
@@ -90,6 +96,11 @@ func (m *DpcManager) updateDNS() { | |
| wwanNetStatus := m.wwanStatus.GetNetworkStatus(port.Logicallabel) | ||
| if wwanNetStatus != nil { | ||
| m.deviceNetStatus.Ports[ix].WirelessStatus.Cellular = *wwanNetStatus | ||
| // A modem's PCI can't be derived from its interface; use the | ||
| // address the wwan microservice resolved. | ||
| if wwanNetStatus.PhysAddrs.PCI != "" { | ||
| m.deviceNetStatus.Ports[ix].PciLong = wwanNetStatus.PhysAddrs.PCI | ||
| } | ||
| } | ||
| } | ||
| // Do not try to get state data for interface which is in PCIback. | ||
|
|
@@ -121,6 +132,14 @@ func (m *DpcManager) updateDNS() { | |
| } | ||
| continue | ||
| } | ||
| // Prefer the PCI resolved from the live interface: it reflects the | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that this should be higher up, above |
||
| // device actually backing the port, regardless of the model's ifname. | ||
| // Cellular is excluded (see above; IfNameToPci can't resolve a modem). | ||
| if port.WirelessCfg.WType != types.WirelessTypeCellular { | ||
| if pciLong, _, err := types.IfNameToPciAndUsbAddr(m.Log, port.IfName); err == nil { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Building on the relocation point already raised above: moving this block above To actually recover the live PCI when the model name is wrong, resolution needs to start from a stable handle (the kernel-observed name / |
||
| m.deviceNetStatus.Ports[ix].PciLong = pciLong | ||
| } | ||
| } | ||
| ifAttrs, err := m.NetworkMonitor.GetInterfaceAttrs(ifindex) | ||
| if err != nil { | ||
| m.Log.Warnf( | ||
|
|
||
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.
Note:
AddOrUpdateIoBundleoverwrites the stored bundle'sErrorwith this freshib.Error(it preservesIsPort/IsPCIBack/PciLong/... but notError). So on everyPhysicalIOAdapterListupdate, the collision / assignment-group-conflict / model-inconsistency entries previously reconciled onto the stored bundle are dropped, along with their stableTimeOfError— the very timestamp stabilitySetSourceErrorswas added to preserve. It's recovered because the checks re-run afterward, but each such update resets those timestamps. SincePhysicalIOAdapterListrepublishes only on model change this is low-impact, but worth a comment or preservingErrorinAddOrUpdateIoBundleso the intent isn't quietly undone.