1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-25 10:36:36 +03:00

nixos/scripted-networking: fix bridge setup when libvirtd uses socket activation

This commit is contained in:
volth 2020-03-09 09:05:13 +00:00 committed by wedens
parent d8664c78b1
commit 687aa06c70

View file

@ -291,6 +291,11 @@ let
${optionalString config.virtualisation.libvirtd.enable '' ${optionalString config.virtualisation.libvirtd.enable ''
# Enslave dynamically added interfaces which may be lost on nixos-rebuild # Enslave dynamically added interfaces which may be lost on nixos-rebuild
#
# if `libvirtd.service` is not running, do not use `virsh` which would try activate it via 'libvirtd.socket' and thus start it out-of-order.
# `libvirtd.service` will set up bridge interfaces when it will start normally.
#
if ${pkgs.systemd}/bin/systemctl --quiet is-active 'libvirtd.service'; then
for uri in qemu:///system lxc:///; do for uri in qemu:///system lxc:///; do
for dom in $(${pkgs.libvirt}/bin/virsh -c $uri list --name); do for dom in $(${pkgs.libvirt}/bin/virsh -c $uri list --name); do
${pkgs.libvirt}/bin/virsh -c $uri dumpxml "$dom" | \ ${pkgs.libvirt}/bin/virsh -c $uri dumpxml "$dom" | \
@ -298,6 +303,7 @@ let
${pkgs.bash}/bin/bash ${pkgs.bash}/bin/bash
done done
done done
fi
''} ''}
# Enable stp on the interface # Enable stp on the interface