Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions qemu/tests/balloon_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,46 @@ def get_disk_vol(self, session):
except Exception:
self.test.error("Could not get virtio-win disk vol!")

def assert_no_wmi_error_5858(self, session):
"""
Ensure there are no WMI-Activity Event ID 5858 entries emitted by the
balloon service since it started.
This checks the 'Microsoft-Windows-WMI-Activity/Operational' log.
"""
if self.params.get("os_type") != "windows":
return
log_name = "Microsoft-Windows-WMI-Activity/Operational"
error_context.context(
"Verify no WMI 5858 events since blnsvr.exe start (log: %s)" % log_name,
self.test.log.info,
)
ps_cmd = self.params.get("wmi_5858_check_cmd")
if not ps_cmd:
self.test.fail("Missing wmi_5858_check_cmd in cfg; WMI 5858 check not run.")
status, output = session.cmd_status_output(ps_cmd)
self.test.log.info(
"WMI 5858 check result: %s (status %s)",
output.strip(),
status,
)
if status == 0:
self.test.log.info(
"No WMI-Activity Event ID 5858 found since blnsvr.exe start."
)
elif status == 1:
self.test.fail(
"Detected WMI-Activity Event ID 5858 since blnsvr.exe start."
)
elif status == 2:
self.test.log.info(
"Balloon service process not running; skipping WMI 5858 check."
)
else:
self.test.fail(
"WMI 5858 check returned unexpected status %s. Output: %s"
% (status, output)
)

@error_context.context_aware
def operate_balloon_service(self, session, operation):
"""
Expand Down
7 changes: 7 additions & 0 deletions qemu/tests/balloon_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,19 @@ def balloon_memory(vm, mem_check, min_sz, max_sz):
mem_stat_working = False
for bln_oper in blnsrv_operation:
error_context.context("%s balloon service" % bln_oper, test.log.info)
windows_run = params.get("os_type") == "windows" and bln_oper == "run"
balloon_test.operate_balloon_service(session, bln_oper)

error_context.context(
"Balloon vm memory after %s balloon service" % bln_oper, test.log.info
)
balloon_memory(vm, mem_check, min_sz, max_sz)
if windows_run:
error_context.context(
"Check Windows Event Log for WMI 5858 after service restart",
test.log.info,
)
balloon_test.assert_no_wmi_error_5858(session)
mem_stat_working = True
# for windows guest, disable/uninstall driver to get memory leak based on
# driver verifier is enabled
Expand Down
1 change: 1 addition & 0 deletions qemu/tests/cfg/balloon_service.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
only Windows
repeat_times = 1
blnsrv_operation = "stop run"
wmi_5858_check_cmd = "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"$ErrorActionPreference='SilentlyContinue'; $log='Microsoft-Windows-WMI-Activity/Operational'; $p=(Get-Process -Name blnsvr -ErrorAction SilentlyContinue | Select-Object -First 1); if (-not $p) { Write-Output 'NO_PID'; exit 2 }; $blnPid=$p.Id; $start=$p.StartTime.ToUniversalTime(); $events = Get-WinEvent -FilterHashtable @{LogName=$log; Id=5858; StartTime=$start} -MaxEvents 50 -ErrorAction SilentlyContinue | Where-Object { $_.Level -eq 2 -and $_.Message -match ('ClientProcessId = ' + $blnPid) }; $e = $events | Select-Object -First 1; if ($null -ne $e) { Write-Output 'HIT'; ($e | Format-List -Property TimeCreated,Id,Message | Out-String).Trim() | Write-Output; exit 1 } else { Write-Output 'NONE'; exit 0 };\""
- sc_interrogate:
type = balloon_sc_interrogate
only Windows
Expand Down