Skip to content

Commit 9de90a5

Browse files
Copilotjmarrero
andauthored
ci: fix missing libvirt default network in test-coreos job
Agent-Logs-Url: https://github.com/bootc-dev/bootc/sessions/ee405f32-f5cc-4142-b943-beb7eecfaf00 Co-authored-by: jmarrero <1894385+jmarrero@users.noreply.github.com>
1 parent a3c9788 commit 9de90a5

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/ci.yml

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

338+
- name: Ensure libvirt default network is present and active
339+
run: |
340+
set -euxo pipefail
341+
342+
virsh net-list --all || true
343+
344+
if ! virsh net-info default >/dev/null 2>&1; then
345+
cat > /tmp/default-net.xml <<'EOF'
346+
<network>
347+
<name>default</name>
348+
<forward mode='nat'/>
349+
<bridge name='virbr0' stp='on' delay='0'/>
350+
<ip address='192.168.122.1' netmask='255.255.255.0'>
351+
<dhcp>
352+
<range start='192.168.122.2' end='192.168.122.254'/>
353+
</dhcp>
354+
</ip>
355+
</network>
356+
EOF
357+
sudo virsh net-define /tmp/default-net.xml
358+
fi
359+
360+
sudo virsh net-start default || true
361+
sudo virsh net-autostart default || true
362+
363+
virsh net-list --all
364+
virsh net-dhcp-leases default || true
365+
338366
- name: Build container and test on CoreOS
339367
run: |
340368
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)