[VIRT] Add Windows crash detection test with hyperv panic device#4425
[VIRT] Add Windows crash detection test with hyperv panic device#4425dshchedr wants to merge 4 commits intoRedHatQE:mainfrom
Conversation
Test Windows BSOD detection using hyperv panic device and hv-crash. Verifies KubeVirt emits GuestPanicked events when Windows crashes. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Denys Shchedrivyi <dshchedr@redhat.com>
📝 WalkthroughWalkthroughAdds a new pytest module that provisions a Hyper‑V panic‑device Windows VM from a golden image, triggers a BSOD via a PowerShell payload over SSH, and verifies a GuestPanicked VMI event is emitted. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
|
/build-and-push-container |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/virt/node/hyperv_support/test_windows_crash_detection.py`:
- Around line 97-102: Add a STD-style docstring to the test function
test_windows_crash_detection_with_hyperv_panic that includes the required
sections: "Preconditions:", "Steps:", and "Expected:"; describe the test
preconditions (e.g., enabled_featuregate_scope_function and
windows_vm_with_panic_device present), the steps performed (calling
wait_for_guest_panicked_event on the VM), and the expected outcome (that a guest
panicked/crash event is detected), so readers can understand intent and
maintenance requirements.
- Around line 1-12: Add a module-level docstring at the top of the test module
(before imports) that briefly describes the test purpose and includes the STP
link required by STD guidelines; update the file containing LOGGER and tests
(test_windows_crash_detection.py) so the new triple-quoted docstring sits above
the import block and references the Software Test Plan URL and any test ID or
requirement traceability info.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1e2e2442-bed0-4dc9-8b99-c1d53c7e6c33
📒 Files selected for processing (1)
tests/virt/node/hyperv_support/test_windows_crash_detection.py
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-4425 published |
2712789 to
9fec666
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/virt/node/hyperv_support/test_windows_crash_detection.py`:
- Around line 63-64: The fixture currently mutates request.param by inserting
vm_dict, which can leak state across parametrized uses; instead, create a copy
of the param payload or pass vm_dict directly into vm_instance_from_template: do
not assign into request.param in the fixture body—either call
vm_instance_from_template(request.param, vm_dict=deepcopy(vm_dict)) or replace
the mutation with request_param_copy = deepcopy(request.param);
request_param_copy["vm_dict"] = vm_dict and use request_param_copy for
downstream calls. Ensure you import/use deepcopy for nested dicts and reference
the existing symbols request.param, vm_dict, and vm_instance_from_template when
making the change.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9dd46d92-ec95-4993-8152-f8d933f67e10
📒 Files selected for processing (1)
tests/virt/node/hyperv_support/test_windows_crash_detection.py
|
/build-and-push-container |
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-4425 published |
|
/verified |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Your deliverable: Test Execution Plan
Guidelines:
Hardware-Related Checks (SR-IOV, GPU, DPDK): When PR modifies fixtures for hardware-specific resources:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1786 🧠 Learnings used |
added pytest marks for virt-sanity checks Signed-off-by: Denys Shchedrivyi <dshchedr@redhat.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
tests/virt/node/hyperv_support/test_windows_crash_detection.py (1)
51-58:⚠️ Potential issue | 🟠 MajorMAJOR: Add timeout parameter to
vm.vmi.events()to prevent race condition.The
events()method supports an explicit timeout parameter (documented in openshift-python-wrapper), and the codebase pattern elsewhere ispod.events(timeout=TIMEOUT_5SEC, field_selector=...). Without specifying a timeout on line 53,vm.vmi.events()uses an implicit (likely very short or 0) default timeout, causing theforloop to complete immediately without waiting for the event to be emitted. This creates a race between the BSOD trigger completing inwindows_crashed(line 47) and KubeVirt recording theGuestPanickedevent — the event may arrive after the poll window closes, causing a false failure.Add
timeout=TIMEOUT_<value>parameter to theevents()call. Alternatively, wrap the entire wait inTimeoutSamplerper coding guidelines.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/virt/node/hyperv_support/test_windows_crash_detection.py` around lines 51 - 58, The wait_for_guest_panicked_event function currently iterates vm.vmi.events(...) without a timeout causing a race; update the call in wait_for_guest_panicked_event to pass an explicit timeout (e.g., timeout=TIMEOUT_5SEC or TIMEOUT_10SEC) to vm.vmi.events(field_selector="reason==GuestPanicked", timeout=TIMEOUT_5SEC) so the loop waits for the event; if preferred follow project pattern and instead wrap the check in a TimeoutSampler; ensure the chosen TIMEOUT_* constant is imported/available where wait_for_guest_panicked_event is defined.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@tests/virt/node/hyperv_support/test_windows_crash_detection.py`:
- Around line 51-58: The wait_for_guest_panicked_event function currently
iterates vm.vmi.events(...) without a timeout causing a race; update the call in
wait_for_guest_panicked_event to pass an explicit timeout (e.g.,
timeout=TIMEOUT_5SEC or TIMEOUT_10SEC) to
vm.vmi.events(field_selector="reason==GuestPanicked", timeout=TIMEOUT_5SEC) so
the loop waits for the event; if preferred follow project pattern and instead
wrap the check in a TimeoutSampler; ensure the chosen TIMEOUT_* constant is
imported/available where wait_for_guest_panicked_event is defined.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1daadbf7-7725-4bb5-9fa1-229565fec8fa
📒 Files selected for processing (1)
tests/virt/node/hyperv_support/test_windows_crash_detection.py
|
/build-and-push-container |
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-4425 published |
Test Windows BSOD detection using hyperv panic device and hv-crash. Verifies KubeVirt emits GuestPanicked events when Windows crashes.
Short description:
More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
jira-ticket:
Summary by CodeRabbit