Harden libvirt connection keepalive handling - #4539
Conversation
🤖 AI Test SelectionNo test cases were selected for this PR. |
There was a problem hiding this comment.
Pull request overview
This PR hardens the libvirt SUT orchestrator’s connection handling to avoid stale shared virConnect objects after libvirtd closes the client socket (e.g., keepalive timeouts), and adds targeted reconnect/retry logic around key domain operations.
Changes:
- Disables daemon-side keepalive while LISA owns the host (via
libvirtd.conf) and disables client-side keepalive on opened connections. - Replaces direct
defineXML/lookupByNameusage with helpers that reopen the libvirt connection and retry when a closed-socket error is detected. - Adds reconnect-and-retry handling for domain destroy/undefine when a stale socket is encountered.
The Cloud Hypervisor passthrough run failed during deployment after libvirtd closed the client connection with a keepalive timeout. Once that happened, the shared virConnect stayed stale and later environments failed immediately with 'client socket is closed'. Configure libvirtd to stop sending daemon-side keepalive probes while LISA owns the host, disable client-side keepalive probes on opened connections, and reconnect/retry focused domain operations when a stale client socket is detected.
5a41818 to
2e10343
Compare
🤖 AI Test SelectionNo test cases were selected for this PR. |
|
@copilot fix check errors |
Fixed in commit |
🤖 AI Test SelectionNo test cases were selected for this PR. |
e88e2af to
7a7d7a6
Compare
🤖 AI Test SelectionNo test cases were selected for this PR. |
…efine_domain helpers
7a7d7a6 to
09267c8
Compare
🤖 AI Test SelectionNo test cases were selected for this PR. |
Release devices back to the libvirt passthrough pool without duplicating entries, then clear the node context so later deployments do not emit stale hostdev XML. This prevents follow-on device-passthrough tests from failing with 'Hostdev already exists in the domain configuration' after a previous deployment has released its devices.
🤖 AI Test SelectionNo test cases were selected for this PR. |
Extract the closed-connection retry flow into a shared helper and use it for domain define, lookup, destroy, and undefine operations. Add explicit domain assertions and keep cleanup retry exceptions logged through the standard exception variable.
🤖 AI Test SelectionNo test cases were selected for this PR. |
🤖 AI Test SelectionNo test cases were selected for this PR. |
07e3305 to
395d0dd
Compare
🤖 AI Test SelectionNo test cases were selected for this PR. |
395d0dd to
ce7bab1
Compare
🤖 AI Test SelectionNo test cases were selected for this PR. |
Route domain.interfaceAddresses through the shared libvirt reconnect helper so IP discovery can recover if the client socket closes after domain lookup.
ce7bab1 to
8034aec
Compare
🤖 AI Test SelectionNo test cases were selected for this PR. |
Cloud Hypervisor passthrough deployments can lose the libvirt SSH transport while attaching the serial console. In the failing run, domain.openConsole() returned a virt-ssh-helper EOF/connection-reset error, which left the shared libvirt connection stale. Later deployments then failed during defineXML() with 'client socket is closed'. Treat the virt-ssh-helper EOF/reset messages as reconnectable libvirt connection errors. Wrap CH domain start plus console attach in the existing reconnect helper so the retry reopens libvirt, looks up the already-defined domain, starts it only if needed, and attaches the console again. Also clean up partially-created console streams and log files when openConsole() fails, so retries do not inherit a half-initialized console logger.
🤖 AI Test SelectionNo test cases were selected for this PR. |
The Cloud Hypervisor passthrough run failed during deployment after libvirtd closed the client connection with a keepalive timeout. Once that happened, the shared virConnect stayed stale and later environments failed immediately with 'client socket is closed'.
Configure libvirtd to stop sending daemon-side keepalive probes while LISA owns the host, disable client-side keepalive probes on opened connections, and reconnect/retry focused domain operations when a stale client socket is detected.
Description
Related Issue
Type of Change
Checklist
Test Validation
Key Test Cases:
Impacted LISA Features:
Tested Azure Marketplace Images:
Test Results