-
Notifications
You must be signed in to change notification settings - Fork 183
Balloon: Check WMI-Activity after restarting balloon service #4420
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?
Conversation
WalkthroughAdds Windows-specific verification for WMI Event ID 5858 during balloon service tests. A new method Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
3d6fadb to
bd5f346
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
qemu/tests/balloon_check.py (1)
504-557: assert_no_wmi_error_5858 behavior and exit-code mapping look solidThe helper cleanly maps the PowerShell command’s exit codes (0/1/2/other) into “pass/fail/skip/warn” semantics, and degrades gracefully when
wmi_5858_check_cmdis missing or returns an unexpected status. This matches the cfg command and avoids breaking non-Windows or misconfigured runs.If, in the future, you want the “run after restart” scenario to also assert that
blnsvris actually running, you could treatstatus == 2as a failure (or add a separate strict mode) in that specific call site, but that’s optional and not required for this PR’s goal.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
qemu/tests/balloon_check.py(1 hunks)qemu/tests/balloon_service.py(1 hunks)qemu/tests/cfg/balloon_service.cfg(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
qemu/tests/balloon_service.py (1)
qemu/tests/balloon_check.py (2)
operate_balloon_service(560-583)assert_no_wmi_error_5858(504-557)
🔇 Additional comments (2)
qemu/tests/cfg/balloon_service.cfg (1)
72-72: WMI 5858 PowerShell probe matches helper expectationsThe PowerShell command’s exit codes (0: NONE, 1: HIT, 2: NO_PID) and log selection/filtering align cleanly with
assert_no_wmi_error_5858, and scoping it under the Windowsdisable_enable(stop/run) variant fits the “restart” use case. Looks good as-is.qemu/tests/balloon_service.py (1)
92-104: Windows-only WMI 5858 check is correctly scoped and placedGating the WMI 5858 check behind
windows_runensures it’s only invoked for Windows runs of the balloon service, and placing it afterballoon_memorykeeps the existing flow intact while adding the new validation. No issues spotted.
Check for WMI-Activity Event ID 5858 since blnsvr.exe start. Filter by ClientProcessId. Use PS exit codes: 0=NONE, 1=HIT, 2=NO_PID. Command configured in cfg. id: 1315 Signed-off-by: Elizabeth Ashurov <eashurov@redhat.com>
bd5f346 to
3c9cc08
Compare
|
Hi @xiagao , I've implemented the suggested changes. |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
qemu/tests/balloon_check.py (1)
510-511: Optional: Remove redundant OS check.This method is in the
BallooningTestWinclass, which is already Windows-specific. The OS type check here is defensive but unnecessary.Consider removing these lines:
- if self.params.get("os_type") != "windows": - return
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
qemu/tests/balloon_check.py(1 hunks)qemu/tests/balloon_service.py(1 hunks)qemu/tests/cfg/balloon_service.cfg(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- qemu/tests/cfg/balloon_service.cfg
🧰 Additional context used
🧬 Code graph analysis (1)
qemu/tests/balloon_service.py (1)
qemu/tests/balloon_check.py (3)
operate_balloon_service(545-568)balloon_memory(195-233)assert_no_wmi_error_5858(504-542)
🔇 Additional comments (5)
qemu/tests/balloon_service.py (1)
92-104: LGTM! Well-structured Windows-specific WMI event validation.The implementation correctly:
- Computes the
windows_runcondition once for reuse- Adds the WMI 5858 check only after "run" operations on Windows guests
- Provides clear error context for logging
- Integrates cleanly with the new
assert_no_wmi_error_5858methodqemu/tests/balloon_check.py (4)
534-537: Verify status 2 handling after "run" operation.Status 2 indicates the balloon service is not running, which triggers an info log and skips the check. However, this method is called immediately after a "run" operation in
balloon_service.py. If the service is not running after being started, this might indicate a failure to start or a crash.Current behavior treats this as a benign skip scenario. Consider whether this should be:
- A test failure (service should be running after "run" operation)
- A warning rather than info (unexpected but not critical)
- The current behavior (acceptable timing/race condition)
Review the test flow to determine if there are legitimate scenarios where the service might not be running immediately after the "run" operation (e.g., slow startup, timing window), or if this always indicates a problem that should fail the test.
517-519: Good defensive check for missing configuration.Explicitly failing when
wmi_5858_check_cmdis missing prevents silent test passes and ensures the check is actually performed. This addresses previous reviewer feedback about ensuring the test doesn't pass without running the validation.
526-542: Well-structured status code handling.The if/elif/else structure cleanly handles all expected status codes with appropriate actions:
- Status 0: Success (no events found)
- Status 1: Test failure (events detected)
- Status 2: Skip scenario (service not running)
- Other: Test failure (unexpected status)
This implementation addresses previous reviewer feedback to use if/elif/else and handle all cases explicitly.
520-520: Add timeout parameter to cmd_status_output call to prevent indefinite blocking.The PowerShell command execution at line 520 lacks an explicit timeout. The
cmd_status_output()method supports a timeout parameter (as shown in similar calls throughout the codebase withtimeout=360,timeout=240, etc.), but this call omits it. If the PowerShell command hangs, test execution could block indefinitely. Consider specifying a reasonable timeout like other operations in the file:status, output = session.cmd_status_output(ps_cmd, timeout=60)
Check for WMI-Activity Event ID 5858 since blnsvr.exe start.
id: 1315
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.