If a linux bridge already exists on the jump host, with the same
name as the value passed via `-B` or the default, use it instead
of trying to create a virsh network.
Change-Id: If7f0753ec366d429ff101c2b37dd68f895903404
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
(cherry picked from commit
96cccf2b507949978c1b37c65961a5182ffbbbfd)
virsh net-undefine "${net}"
fi
# in case of custom network, host should already have the bridge in place
virsh net-undefine "${net}"
fi
# in case of custom network, host should already have the bridge in place
- if [ -f "net_${net}.xml" ]; then
+ if [ -f "net_${net}.xml" ] && [ ! -d "/sys/class/net/${net}/bridge" ]; then
virsh net-define "net_${net}.xml"
virsh net-autostart "${net}"
virsh net-start "${net}"
virsh net-define "net_${net}.xml"
virsh net-autostart "${net}"
virsh net-start "${net}"
vnode_networks[2]="${vnode_networks[0]}"
fi
for net in "${vnode_networks[@]:1}"; do
vnode_networks[2]="${vnode_networks[0]}"
fi
for net in "${vnode_networks[@]:1}"; do
# in case of custom network, host should already have the bridge in place
# in case of custom network, host should already have the bridge in place
- if [ ! -f "net_${net}.xml" ]; then
- net_type="bridge"
+ if [ -f "net_${net}.xml" ] && \
+ [ ! -d "/sys/class/net/${net}/bridge" ]; then
+ net_type="network"
fi
net_args="${net_args} --network ${net_type}=${net},model=virtio"
done
fi
net_args="${net_args} --network ${net_type}=${net},model=virtio"
done