Skip to content

Detect SR-IOV VFs via AZURE_UNMANAGED_SRIOV udev property#444

Open
s4heid wants to merge 2 commits into
cloudfoundry:mainfrom
s4heid:azure-sriov-detection
Open

Detect SR-IOV VFs via AZURE_UNMANAGED_SRIOV udev property#444
s4heid wants to merge 2 commits into
cloudfoundry:mainfrom
s4heid:azure-sriov-detection

Conversation

@s4heid

@s4heid s4heid commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Replace the sriov-vf ifalias check in the MAC address detector with detection of the AZURE_UNMANAGED_SRIOV=1 udev property applied by azure-vm-utils to SR-IOV VF devices bonded under hv_netvsc.

This makes MAC-based interface detection correct on stemcells that ship azure-vm-utils (e.g. Ubuntu Noble) without requiring a parallel stemcell-side ifalias workaround.

Stemcells that currently set ATTR{ifalias}="sriov-vf" (e.g. Ubuntu Jammy) already set ENV{AZURE_UNMANAGED_SRIOV}="1" alongside, so the new check is a strict superset of the previous behaviour.

The property is read from /run/udev/data/n<ifindex>, where udev persists per-device properties as lines of the form "E:KEY=VALUE".

Self-Validation

Built the agent, baked it into the latest noble stemcell and re-deployed with accelerated-networking enabled on Azure. Based on the logs it looks like the agent is going the right code path and ignores the VF interface (which uses mlx5_core driver):

zookeeper/df0f0087-4274-4862-aa82-04d601f3b1ea: ~# zgrep "Ignoring SR-IOV VF interface" /var/vcap/bosh/log/*
2026-06-26T15:32:47.924626+00:00 ab4fdf5c-2b60-431f-9995-5c53890866ae bosh-agent[1755]: [MacAddressDetectorl 2026/06/
6 15:32:47 DEBUG - Ignoring SR-IOV VF interface: eth1 (AZURE_UNMANAGED_SRIOV=1)
2026-06-26T15:32:52.694369+00:00 ab4fdf5c-2b60-431f-9995-5c53890866ae bosh-agent[3214]: [MacAddressDetector] 2026/06/
6 15:32:52 DEBUG - Ignoring SR-IOV VF interface: eth1 (AZURE_UNMANAGED_SRIOV=1)

zookeeper/df0f0087-4274-4862-aa82-04d601f3b1ea:~# ethtool -i eth1 | grep driver
driver: mlx5_core

Replace the sriov-vf ifalias check in the MAC address detector with
detection of the `AZURE_UNMANAGED_SRIOV=1` udev property applied by
azure-vm-utils to SR-IOV VF devices bonded under hv_netvsc.

This makes MAC-based interface detection correct on stemcells that
ship azure-vm-utils (e.g. Ubuntu Noble) without requiring a parallel
stemcell-side ifalias workaround.

Stemcells that currently set ATTR{ifalias}="sriov-vf" (e.g. Ubuntu
Jammy) already set ENV{AZURE_UNMANAGED_SRIOV}="1" alongside, so the
new check is a strict superset of the previous behaviour.

The property is read from /run/udev/data/n<ifindex>, where udev
persists per-device properties as lines of the form "E:KEY=VALUE".
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@s4heid, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 29 minutes and 49 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 073cce6d-3395-403e-b69d-b8ac32b7c731

📥 Commits

Reviewing files that changed from the base of the PR and between a2b2878 and 4cb6955.

📒 Files selected for processing (1)
  • platform/net/mac_address_detector_test.go

Walkthrough

Linux MAC address detection now checks per-interface udev records for AZURE_UNMANAGED_SRIOV=1 and skips matching interfaces instead of using ifalias SR-IOV VF text. The detector reads the interface ifindex, loads /run/udev/data/n<ifindex>, and searches the udev contents for the tag. Tests were updated to cover unmanaged VF interfaces, missing udev data, and non-matching udev entries.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: detecting SR-IOV VFs via the AZURE_UNMANAGED_SRIOV udev property.
Description check ✅ Passed The description is directly related to the code changes and explains the detection switch, compatibility, and validation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@platform/net/mac_address_detector_test.go`:
- Around line 143-151: The test in mac_address_detector_test.go does not reach
the missing-udev-data branch because stubInterfacesWithVirtual only creates
address/ifalias and never an ifindex, causing isAzureUnmanagedSRIOV to fail
earlier. Update the test setup so the interface has a valid ifindex file while
intentionally omitting the /run/udev/data/n<ifindex> file, then keep the
DetectMacAddresses assertion in the same test to verify the missing-udev-data
path is exercised. Use the existing helpers and the isAzureUnmanagedSRIOV flow
to ensure the branch under test is actually hit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f6a411a7-cb17-4226-a7b0-06a1c22cc1cf

📥 Commits

Reviewing files that changed from the base of the PR and between cb03d31 and a2b2878.

📒 Files selected for processing (2)
  • platform/net/mac_address_detector.go
  • platform/net/mac_address_detector_test.go

Comment thread platform/net/mac_address_detector_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending Merge | Prioritized

Development

Successfully merging this pull request may close these issues.

1 participant