Skip to content

Add nwswitch/link validations for host and VM side#23

Open
bogdando wants to merge 1 commit into
rhos-vaf:mainfrom
bogdando:nvswitch
Open

Add nwswitch/link validations for host and VM side#23
bogdando wants to merge 1 commit into
rhos-vaf:mainfrom
bogdando:nvswitch

Conversation

@bogdando

@bogdando bogdando commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Related: RHOSSTRAT-518
Closes: OSPRH-27633

Generated-by: claude-4.6-opus-high]

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an Ansible NVSwitch validation playbook with configurable defaults, mode-specific host checks for FABRIC_MODE 0–2, and in-VM GPU isolation checks covering visibility, NVLink topology, fabric state, partitions, and mdev instances.

Changes

NVSwitch validation

Layer / File(s) Summary
Configuration and mode dispatch
gpu-validation/defaults/main.yaml, nvswitch_validation.yaml
Defines NVSwitch validation parameters, validates inventory and fabric-mode inputs, and dispatches host and VM tasks by selected mode.
Shared host collection and assertions
gpu-validation/tasks/nvswitch.yaml, gpu-validation/tasks/nvswitch_assertions.yaml
Collects Fabric Manager states, GPU fabric states, partitions, and topology, then validates configured host expectations.
Mode-specific host validation
gpu-validation/tasks/nvswitch_mode0*, gpu-validation/tasks/nvswitch_mode1*, gpu-validation/tasks/nvswitch_mode2*
Adds mode-specific service, fabric, partition, configuration-file, and mdev checks.
Shared VM isolation collection and assertions
gpu-validation/tasks/nvswitch_isolation*
Checks GPU visibility and NVLink topology inside GPU VMs.
Mode-specific VM isolation validation
gpu-validation/tasks/nvswitch_mode0_isolation*, gpu-validation/tasks/nvswitch_mode1_isolation*, gpu-validation/tasks/nvswitch_mode2_isolation*
Validates per-VM GPU counts, NVLink entries, topology visibility, and mode-specific isolation behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: miguelcarpio

Sequence Diagram(s)

sequenceDiagram
  participant nvswitch_validation
  participant edpm_hosts
  participant gpu_vms
  nvswitch_validation->>edpm_hosts: run mode-specific host collection
  edpm_hosts->>edpm_hosts: assert services, fabric state, partitions, or mdev count
  nvswitch_validation->>gpu_vms: run mode-specific VM collection
  gpu_vms->>gpu_vms: assert GPU count and NVLink topology isolation
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding host- and VM-side NVSwitch/link validations.
Description check ✅ Passed The description is related to the changeset because it links the PR to the relevant issue and closure ticket.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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

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

@bogdando
bogdando force-pushed the nvswitch branch 2 times, most recently from 531ad82 to 7467c4d Compare July 2, 2026 17:05
@bogdando
bogdando marked this pull request as ready for review July 10, 2026 15:50
@bogdando

Copy link
Copy Markdown
Contributor Author

confirmed it works with NVSwitch and Fabric Manager mode 0 on hgx b 300 guest VM

@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: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
gpu-validation/tasks/nvswitch_mode2_isolation.yaml (1)

33-41: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use a double-escaped word boundary here. '\bNV[0-9]' is parsed by Jinja as a backspace character, so the search never matches NVLink lines and the Mode 2 assertion will fail.

Proposed fix
-         | select('search', '\bNV[0-9]')
+         | select('search', '\\bNV[0-9]')
🤖 Prompt for 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.

In `@gpu-validation/tasks/nvswitch_mode2_isolation.yaml` around lines 33 - 41,
Update the `nvswitch_vm_nvlink_lines` expression in the “Set in-VM topology
facts” task to use a double-escaped word boundary (`'\\bNV[0-9]'`) so Jinja
passes the regex boundary correctly and NVLink lines are matched.
gpu-validation/tasks/nvswitch_mode0_isolation.yaml (1)

36-44: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fix the NVLink regex in gpu-validation/tasks/nvswitch_mode0_isolation.yaml:42. '\bNV[0-9]' becomes a backspace escape here, so nvswitch_vm_nvlink_lines stays empty and the multi-GPU assertion in nvswitch_mode0_isolation_assertions.yaml will always fail. Use '\\bNV[0-9]' to match the shared files.

🤖 Prompt for 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.

In `@gpu-validation/tasks/nvswitch_mode0_isolation.yaml` around lines 36 - 44, Fix
the regex used by the nvswitch_vm_nvlink_lines fact in the “Set in-VM topology
facts” task: escape the backslash as '\\bNV[0-9]' so it performs a word-boundary
NVLink match instead of interpreting \b as a backspace, consistent with the
shared files.
🧹 Nitpick comments (2)
gpu-validation/tasks/nvswitch_mode0.yaml (1)

27-89: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Duplicated collection logic across all three mode host files.

The FM service status collection+facts (Lines 27-46), Fabric State collection+facts (Lines 48-70), and NVLink topology collection+facts (Lines 72-89) here are copy-pasted almost verbatim in nvswitch_mode1.yaml (Lines 4-84) and nvswitch_mode2.yaml (Lines 6-82), differing only in the FM service-list variable and minor debug text. Consider extracting a shared parameterized task file for the common parts, leaving each mode file to add only its mode-specific checks (cfg parsing, fmpm -l, mdevctl list).

This also appears to overlap with the "Shared host collection" layer (nvswitch.yaml), which per the PR stack is described as collecting "Fabric Manager state, GPU fabric state, activated partitions, and topology" — the same data collected here. Worth confirming these aren't run twice per host.

🤖 Prompt for 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.

In `@gpu-validation/tasks/nvswitch_mode0.yaml` around lines 27 - 89, Extract the
duplicated FM service, GPU fabric-state, and NVLink topology collection into a
shared parameterized task file, referenced by nvswitch_mode0.yaml,
nvswitch_mode1.yaml, and nvswitch_mode2.yaml with each mode’s service-list
variable and mode-specific messaging as inputs. Reconcile this shared collection
with the existing nvswitch.yaml host-collection layer and remove or reuse
overlapping tasks so each host gathers these facts only once, while leaving
mode-specific checks in the individual mode files.
gpu-validation/tasks/nvswitch_mode1_isolation.yaml (1)

1-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Exact duplicate of gpu-validation/tasks/nvswitch_isolation.yaml. Consolidate this into the shared task file to avoid drift.

🤖 Prompt for 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.

In `@gpu-validation/tasks/nvswitch_mode1_isolation.yaml` around lines 1 - 40,
Remove the duplicated task definitions from nvswitch_mode1_isolation.yaml and
reuse the shared nvswitch_isolation.yaml task file instead. Preserve the
existing GPU count, topology collection, debug output, and fact-setting behavior
through the shared include/import mechanism.
🤖 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 `@gpu-validation/tasks/nvswitch_assertions.yaml`:
- Around line 12-24: Add a separate assertion in the Fabric State validation
task to verify the detected GPU count matches
nvswitch_validation_expected_gpu_count, in addition to the existing
nvswitch_fabric_completed_count check. Update fail_msg and success_msg as needed
to clearly report the discovered count, using the variables established by the
GPU discovery tasks.

In `@gpu-validation/tasks/nvswitch_isolation_assertions.yaml`:
- Around line 31-42: Remove the redundant “Assert GPU count in topo matches
expected” assertion from nvswitch_isolation_assertions.yaml, since
nvswitch_vm_gpu_count comes from nvidia-smi query-gpu output rather than
_vm_topo. Apply the same removal to nvswitch_mode1_isolation_assertions.yaml and
nvswitch_mode2_isolation_assertions.yaml, including their associated messages.

In `@gpu-validation/tasks/nvswitch_mode0.yaml`:
- Around line 35-41: Fix the Jinja spacing in the nvswitch_fm_service_results
set_fact expression by formatting the zip(...) call according to Ansible-lint
spacing conventions, without changing its mapping or resulting values.
- Around line 21-25: Fix the regex backreference in the “Set FABRIC_MODE config
fact” task by changing the regex_search replacement argument from '\1' to '\\1',
preserving the existing | first pipeline and default handling.

In `@gpu-validation/tasks/nvswitch_mode1.yaml`:
- Around line 12-18: The Jinja expression assigning nvswitch_fm_service_results
has inconsistent spacing around the zip filter, matching the issue in
nvswitch_mode0.yaml. Reformat the map/zip pipeline with the project’s required
spacing conventions while preserving its behavior.
- Around line 1-84: Add a validation task to the mode 1 and mode 2 workflows,
matching the existing fabricmanager.cfg/FABRIC_MODE check in
nvswitch_mode0.yaml, and ensure the shared nvswitch.yaml flow also invokes it.
Reference the corresponding task or validation symbol from mode 0 to keep
expected-value handling and failure reporting consistent, so stale FABRIC_MODE
settings are detected before other checks run.

In `@gpu-validation/tasks/nvswitch_mode2.yaml`:
- Around line 14-20: The Jinja expression assigning nvswitch_fm_service_results
has inconsistent spacing around the zip filter, triggering the lint warning.
Update the expression in the “Set FM service status facts” task to match the
spacing convention already used in nvswitch_mode0.yaml and nvswitch_mode1.yaml,
without changing its behavior.

In `@nvswitch_validation.yaml`:
- Around line 36-40: Remove ignore_errors: true from both host-side and VM
assertion tasks in nvswitch_validation.yaml so failures from the gpu-validation
role propagate and cause the playbook to fail.
- Around line 31-34: Move the default definition of
nvswitch_validation_fabric_mode out of the gpu-validation role defaults and
define it in the play, inventory, or extra-vars instead. Ensure the include_role
task using tasks_from "nvswitch_mode{{ nvswitch_validation_fabric_mode }}.yaml"
resolves the selector from play context, including the corresponding occurrence
around the additional referenced block.

---

Outside diff comments:
In `@gpu-validation/tasks/nvswitch_mode0_isolation.yaml`:
- Around line 36-44: Fix the regex used by the nvswitch_vm_nvlink_lines fact in
the “Set in-VM topology facts” task: escape the backslash as '\\bNV[0-9]' so it
performs a word-boundary NVLink match instead of interpreting \b as a backspace,
consistent with the shared files.

In `@gpu-validation/tasks/nvswitch_mode2_isolation.yaml`:
- Around line 33-41: Update the `nvswitch_vm_nvlink_lines` expression in the
“Set in-VM topology facts” task to use a double-escaped word boundary
(`'\\bNV[0-9]'`) so Jinja passes the regex boundary correctly and NVLink lines
are matched.

---

Nitpick comments:
In `@gpu-validation/tasks/nvswitch_mode0.yaml`:
- Around line 27-89: Extract the duplicated FM service, GPU fabric-state, and
NVLink topology collection into a shared parameterized task file, referenced by
nvswitch_mode0.yaml, nvswitch_mode1.yaml, and nvswitch_mode2.yaml with each
mode’s service-list variable and mode-specific messaging as inputs. Reconcile
this shared collection with the existing nvswitch.yaml host-collection layer and
remove or reuse overlapping tasks so each host gathers these facts only once,
while leaving mode-specific checks in the individual mode files.

In `@gpu-validation/tasks/nvswitch_mode1_isolation.yaml`:
- Around line 1-40: Remove the duplicated task definitions from
nvswitch_mode1_isolation.yaml and reuse the shared nvswitch_isolation.yaml task
file instead. Preserve the existing GPU count, topology collection, debug
output, and fact-setting behavior through the shared include/import mechanism.
🪄 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: CHILL

Plan: Enterprise

Run ID: c7fffd94-0a7d-49d6-bad6-e0ce6b431b7b

📥 Commits

Reviewing files that changed from the base of the PR and between e70ba0c and c31d028.

📒 Files selected for processing (18)
  • gpu-validation/defaults/main.yaml
  • gpu-validation/tasks/nvswitch.yaml
  • gpu-validation/tasks/nvswitch_assertions.yaml
  • gpu-validation/tasks/nvswitch_isolation.yaml
  • gpu-validation/tasks/nvswitch_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0.yaml
  • gpu-validation/tasks/nvswitch_mode0_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1.yaml
  • gpu-validation/tasks/nvswitch_mode1_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode2.yaml
  • gpu-validation/tasks/nvswitch_mode2_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation_assertions.yaml
  • nvswitch_validation.yaml

Comment thread gpu-validation/tasks/nvswitch_assertions.yaml Outdated
Comment thread gpu-validation/tasks/nvswitch_isolation_assertions.yaml Outdated
Comment thread gpu-validation/tasks/nvswitch_mode0.yaml
Comment thread gpu-validation/tasks/nvswitch_mode1.yaml Outdated
Comment thread gpu-validation/tasks/nvswitch_mode1.yaml
Comment thread gpu-validation/tasks/nvswitch_mode2.yaml
Comment thread nvswitch_validation.yaml Outdated
Comment thread nvswitch_validation.yaml Outdated

@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: 4

🤖 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 `@gpu-validation/tasks/nvswitch_mode0.yaml`:
- Around line 21-25: In the “Set FABRIC_MODE config fact” task, guard the result
of regex_search before applying first. Update the nvswitch_fabric_mode_cfg_value
expression to default a missing or malformed regex result to an empty list (or
equivalent fallback) before first, then retain -1 as the final fallback so
validation can report invalid configuration.

In `@nvswitch_validation.yaml`:
- Around line 26-33: Add a localhost preflight play before the existing
Host-side checks play that validates inventory membership with assertions:
require edpm_hosts to contain at least one host and gpu_vms to contain at least
two hosts. Use localhost for this validation so it always executes even when the
target groups are empty or unmatched, and fail with clear messages when either
requirement is not met.
- Around line 37-41: Update the assertion for nvswitch_validation_fabric_mode to
validate the original value against the exact allowed strings ('0', '1', and
'2') instead of relying on the int filter, then normalize it once to an integer
and reuse that normalized variable in all four task includes using tasks_from.
- Around line 4-9: Ensure both the edpm_hosts and gpu_vms plays in
nvswitch_validation.yaml use one shared source for
nvswitch_validation_fabric_mode, such as extra-vars or group_vars/all, rather
than resolving it independently; alternatively, add a pre-dispatch assertion
that both play contexts resolve the same value.
🪄 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: CHILL

Plan: Enterprise

Run ID: ad1a483b-8bd8-4dec-a361-b906638eb54b

📥 Commits

Reviewing files that changed from the base of the PR and between c31d028 and c801341.

📒 Files selected for processing (18)
  • gpu-validation/defaults/main.yaml
  • gpu-validation/tasks/nvswitch.yaml
  • gpu-validation/tasks/nvswitch_assertions.yaml
  • gpu-validation/tasks/nvswitch_isolation.yaml
  • gpu-validation/tasks/nvswitch_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0.yaml
  • gpu-validation/tasks/nvswitch_mode0_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1.yaml
  • gpu-validation/tasks/nvswitch_mode1_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode2.yaml
  • gpu-validation/tasks/nvswitch_mode2_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation_assertions.yaml
  • nvswitch_validation.yaml
🚧 Files skipped from review as they are similar to previous changes (13)
  • gpu-validation/tasks/nvswitch_mode2_assertions.yaml
  • gpu-validation/tasks/nvswitch_assertions.yaml
  • gpu-validation/defaults/main.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation.yaml
  • gpu-validation/tasks/nvswitch_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation.yaml
  • gpu-validation/tasks/nvswitch_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode0_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation_assertions.yaml

Comment thread gpu-validation/tasks/nvswitch_mode0.yaml Outdated
Comment thread nvswitch_validation.yaml Outdated
Comment thread nvswitch_validation.yaml
Comment thread nvswitch_validation.yaml Outdated
Comment thread gpu-validation/defaults/main.yaml Outdated

@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 `@nvswitch_validation.yaml`:
- Around line 60-70: Update the fabric-mode assertions for both the nvswitch and
gpu_vms plays to validate the raw value is numeric before converting it,
preventing non-numeric inputs from being coerced to 0. Preserve acceptance of
numeric values 0, 1, and 2 and ensure invalid strings trigger the existing
fail_msg before any include_role/tasks_from execution.
🪄 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: CHILL

Plan: Enterprise

Run ID: e04bf955-9900-448e-baed-d7db04ea436f

📥 Commits

Reviewing files that changed from the base of the PR and between 101af20 and f414072.

📒 Files selected for processing (18)
  • gpu-validation/defaults/main.yaml
  • gpu-validation/tasks/nvswitch.yaml
  • gpu-validation/tasks/nvswitch_assertions.yaml
  • gpu-validation/tasks/nvswitch_isolation.yaml
  • gpu-validation/tasks/nvswitch_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0.yaml
  • gpu-validation/tasks/nvswitch_mode0_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1.yaml
  • gpu-validation/tasks/nvswitch_mode1_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode2.yaml
  • gpu-validation/tasks/nvswitch_mode2_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation_assertions.yaml
  • nvswitch_validation.yaml
🚧 Files skipped from review as they are similar to previous changes (16)
  • gpu-validation/defaults/main.yaml
  • gpu-validation/tasks/nvswitch_mode1_assertions.yaml
  • gpu-validation/tasks/nvswitch_assertions.yaml
  • gpu-validation/tasks/nvswitch.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation.yaml
  • gpu-validation/tasks/nvswitch_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode2_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0.yaml
  • gpu-validation/tasks/nvswitch_mode2.yaml
  • gpu-validation/tasks/nvswitch_mode1.yaml

Comment thread nvswitch_validation.yaml
MiguelCarpio
MiguelCarpio previously approved these changes Jul 13, 2026

@MiguelCarpio MiguelCarpio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@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: 4

♻️ Duplicate comments (1)
gpu-validation/tasks/nvswitch_mode1.yaml (1)

1-84: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

FABRIC_MODE cfg check still missing for mode 1 (and mode 2).

A prior review flagged that nvswitch_mode1.yaml/nvswitch_mode2.yaml don't validate fabricmanager.cfg's FABRIC_MODE the way nvswitch_mode0.yaml does, leaving stale FM config undetected for these modes. That comment wasn't marked addressed and the gap is still present in the current file.

🤖 Prompt for 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.

In `@gpu-validation/tasks/nvswitch_mode1.yaml` around lines 1 - 84, The mode 1
validation tasks do not inspect fabricmanager.cfg for the expected FABRIC_MODE.
Add a configuration check to nvswitch_mode1.yaml, matching the established
validation used by nvswitch_mode0.yaml, and fail or report when the configured
value does not match the mode 1 expectation. Apply the corresponding check to
nvswitch_mode2.yaml as well if it shares the same omission.
🧹 Nitpick comments (1)
gpu-validation/tasks/nvswitch.yaml (1)

25-84: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Fabric-state / fmpm / topology collection is duplicated across mode files.

This shared file's FM-service, fabric-state, fmpm-partition, and topology collection (lines 12-84) is copy-pasted almost verbatim into nvswitch_mode1.yaml (same header comment, same commands), and its fabric-state + topology blocks are duplicated again in nvswitch_mode0.yaml and nvswitch_mode2.yaml. If the mode dispatcher runs this shared file and then the mode-specific file for every run (as the PR stack description implies), the same privileged commands (nvidia-smi -q, fmpm -l, nvidia-smi topo -m) execute twice, and the mode-specific run overwrites gpu_validation_nvswitch_fabric_states/gpu_validation_nvswitch_topo_output/etc. Depending on task ordering relative to nvswitch_assertions.yaml, this duplication could also cause the shared assertions to evaluate against facts overwritten by the mode-specific run rather than the intended shared collection. Consider having the mode-specific files only add their unique checks (FABRIC_MODE cfg, mdev list, mode-specific FM services) and rely on this shared file for fabric state/topology.

🤖 Prompt for 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.

In `@gpu-validation/tasks/nvswitch.yaml` around lines 25 - 84, The shared
collection tasks should be the sole source for fabric state, fmpm partitions,
and NVLink topology facts. Remove the duplicated collection blocks from
nvswitch_mode0.yaml, nvswitch_mode1.yaml, and nvswitch_mode2.yaml, leaving those
files to perform only their mode-specific checks and FM-service work; preserve
the shared task symbols gpu_validation_nvswitch_fabric_states,
gpu_validation_nvswitch_fmpm_output, and gpu_validation_nvswitch_topo_output.
🤖 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 `@gpu-validation/tasks/nvswitch_mode1_isolation_assertions.yaml`:
- Line 18: Update the NVLink isolation assertion using
gpu_validation_nvswitch_vm_nvlink_lines so it requires the expected minimum
number of connected GPU rows for the VM, rather than merely checking that at
least one row exists; preserve the existing topology validation flow and use the
established GPU-count or expected-row value if available.

In `@gpu-validation/tasks/nvswitch_mode2_isolation.yaml`:
- Line 39: Update the regex passed to the select search in the nvswitch
isolation task so the word-boundary escape is preserved through Jinja parsing,
using the same escaped-pattern convention as the later \d expression and
continuing to match NV1-style entries.

In `@gpu-validation/tasks/nvswitch.yaml`:
- Around line 12-18: Fix the persistent Jinja spacing warning in the
gpu_validation_nvswitch_fm_service_results expression by placing the first
_fm_service_status.results argument on the same line as zip(. Apply this
formatting change in gpu-validation/tasks/nvswitch.yaml lines 12-18,
gpu-validation/tasks/nvswitch_mode0.yaml lines 35-41,
gpu-validation/tasks/nvswitch_mode1.yaml lines 12-18, and
gpu-validation/tasks/nvswitch_mode2.yaml lines 14-20; leave the remaining
expression unchanged.
- Around line 61-68: Update the activated-partition counting expressions in
gpu-validation/tasks/nvswitch.yaml lines 61-68 and
gpu-validation/tasks/nvswitch_mode1.yaml lines 61-68 to use an exact
activated-state match that excludes deactivated entries, while preserving the
existing output and count fact assignments.

---

Duplicate comments:
In `@gpu-validation/tasks/nvswitch_mode1.yaml`:
- Around line 1-84: The mode 1 validation tasks do not inspect fabricmanager.cfg
for the expected FABRIC_MODE. Add a configuration check to nvswitch_mode1.yaml,
matching the established validation used by nvswitch_mode0.yaml, and fail or
report when the configured value does not match the mode 1 expectation. Apply
the corresponding check to nvswitch_mode2.yaml as well if it shares the same
omission.

---

Nitpick comments:
In `@gpu-validation/tasks/nvswitch.yaml`:
- Around line 25-84: The shared collection tasks should be the sole source for
fabric state, fmpm partitions, and NVLink topology facts. Remove the duplicated
collection blocks from nvswitch_mode0.yaml, nvswitch_mode1.yaml, and
nvswitch_mode2.yaml, leaving those files to perform only their mode-specific
checks and FM-service work; preserve the shared task symbols
gpu_validation_nvswitch_fabric_states, gpu_validation_nvswitch_fmpm_output, and
gpu_validation_nvswitch_topo_output.
🪄 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: CHILL

Plan: Enterprise

Run ID: 375c5df9-f01a-4b05-9548-ca0f663e2f05

📥 Commits

Reviewing files that changed from the base of the PR and between f414072 and 2720777.

📒 Files selected for processing (18)
  • gpu-validation/defaults/main.yaml
  • gpu-validation/tasks/nvswitch.yaml
  • gpu-validation/tasks/nvswitch_assertions.yaml
  • gpu-validation/tasks/nvswitch_isolation.yaml
  • gpu-validation/tasks/nvswitch_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0.yaml
  • gpu-validation/tasks/nvswitch_mode0_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1.yaml
  • gpu-validation/tasks/nvswitch_mode1_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode2.yaml
  • gpu-validation/tasks/nvswitch_mode2_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation_assertions.yaml
  • nvswitch_validation.yaml
🚧 Files skipped from review as they are similar to previous changes (12)
  • gpu-validation/tasks/nvswitch_mode2_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode1_isolation.yaml
  • nvswitch_validation.yaml
  • gpu-validation/tasks/nvswitch_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_assertions.yaml
  • gpu-validation/tasks/nvswitch_isolation.yaml
  • gpu-validation/tasks/nvswitch_mode2_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode1_assertions.yaml
  • gpu-validation/defaults/main.yaml
  • gpu-validation/tasks/nvswitch_mode0_isolation_assertions.yaml
  • gpu-validation/tasks/nvswitch_mode0_assertions.yaml

Comment thread gpu-validation/tasks/nvswitch_mode1_isolation_assertions.yaml
Comment thread gpu-validation/tasks/nvswitch_mode2_isolation.yaml Outdated
Comment thread gpu-validation/tasks/nvswitch.yaml
Comment thread gpu-validation/tasks/nvswitch.yaml
Provide validations for nwswitch/nvlink for all the
supported Fabric Manager modes 0-1-2.

Generated-by: claude-4.6-opus-high
Signed-off-by: Bohdan Dobrelia <bdobreli@redhat.com>
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.

2 participants