From 2b4a1357564455a6ab3af242cb0d7a38f6616fb5 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Thu, 26 Mar 2026 17:29:23 -0400 Subject: [PATCH] mgr/rook: handle inactive libvirt default network in recreate_default_network net-destroy fails if the network exists but is already inactive, causing the script to exit before net-define is attempted. Check for this case and fall through to net-undefine directly so the network can be cleanly recreated regardless of its initial state. Signed-off-by: David Galloway --- src/pybind/mgr/rook/ci/scripts/bootstrap-rook-cluster.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/rook/ci/scripts/bootstrap-rook-cluster.sh b/src/pybind/mgr/rook/ci/scripts/bootstrap-rook-cluster.sh index 0005e3f23f6..c8b56ccfb54 100755 --- a/src/pybind/mgr/rook/ci/scripts/bootstrap-rook-cluster.sh +++ b/src/pybind/mgr/rook/ci/scripts/bootstrap-rook-cluster.sh @@ -152,9 +152,12 @@ configure_libvirt(){ recreate_default_network(){ - # destroy any existing kvm default network - if sudo virsh net-destroy default; then - sudo virsh net-undefine default + # destroy and undefine any existing default network, active or not + if sudo virsh net-destroy default 2>/dev/null; then + sudo virsh net-undefine default + elif sudo virsh net-info default &>/dev/null; then + # network exists but is already inactive, just undefine it + sudo virsh net-undefine default fi # let's create a new kvm default network -- 2.47.3