Skip to content

Commit ce5f314

Browse files
Copilotjmarrero
andauthored
ci: add libvirt diagnostics and network activation for CoreOS TMT tests
Add dump_libvirt_diagnostics() in tmt.rs to capture virsh state when SSH connectivity verification fails (VM list, network list, DHCP leases, dominfo, domiflist, dumpxml). Add a CI step in the test-coreos job to ensure the libvirt default network is active before running CoreOS tests. Assisted-by: GitHub Copilot (claude-sonnet-4.5) Agent-Logs-Url: https://github.com/bootc-dev/bootc/sessions/fc40be37-2aea-41f1-b021-4f5b1d804a4a Co-authored-by: jmarrero <1894385+jmarrero@users.noreply.github.com>
1 parent 4899f0c commit ce5f314

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,19 @@ jobs:
335335
name: packages-fedora-43
336336
path: target/packages/
337337

338+
- name: Ensure libvirt default network is active
339+
run: |
340+
set -euxo pipefail
341+
virsh net-list --all
342+
if virsh net-info default >/dev/null 2>&1; then
343+
if ! virsh net-start default; then
344+
echo "Note: virsh net-start default returned non-zero (network may already be active)"
345+
fi
346+
virsh net-autostart default || echo "Note: virsh net-autostart default returned non-zero"
347+
fi
348+
virsh net-list --all
349+
virsh net-dhcp-leases default || echo "Note: no DHCP leases yet for default network"
350+
338351
- name: Build container and test on CoreOS
339352
run: |
340353
BOOTC_SKIP_PACKAGE=1 just build

crates/xtask/src/tmt.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,19 @@ fn wait_for_vm_ready(sh: &Shell, vm_name: &str) -> Result<(u16, String)> {
199199
)
200200
}
201201

202+
/// Dump libvirt diagnostics for a VM to aid debugging when SSH connectivity fails.
203+
/// Prints virsh information to stderr; all commands are best-effort (errors are ignored).
204+
fn dump_libvirt_diagnostics(sh: &Shell, vm_name: &str) {
205+
eprintln!("=== libvirt diagnostics ===");
206+
let _ = cmd!(sh, "virsh list --all").ignore_status().run();
207+
let _ = cmd!(sh, "virsh net-list --all").ignore_status().run();
208+
let _ = cmd!(sh, "virsh net-dhcp-leases default").ignore_status().run();
209+
let _ = cmd!(sh, "virsh dominfo {vm_name}").ignore_status().run();
210+
let _ = cmd!(sh, "virsh domiflist {vm_name}").ignore_status().run();
211+
let _ = cmd!(sh, "virsh dumpxml {vm_name}").ignore_status().run();
212+
eprintln!("=== end libvirt diagnostics ===");
213+
}
214+
202215
/// Verify SSH connectivity to the VM
203216
/// Uses a more complex command similar to what TMT runs to ensure full readiness
204217
#[context("Verifying SSH connectivity")]
@@ -597,6 +610,7 @@ pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
597610
println!("Verifying SSH connectivity...");
598611
if let Err(e) = verify_ssh_connectivity(sh, ssh_port, &key_path) {
599612
eprintln!("SSH verification failed for plan {}: {:#}", plan, e);
613+
dump_libvirt_diagnostics(sh, &vm_name);
600614
cleanup_vm();
601615
all_passed = false;
602616
test_results.push((plan.to_string(), false, None));

0 commit comments

Comments
 (0)