Merge pull request #27678 from volth/restore-bridge-slaves-dynamically-added-by-libvirt
nixos/networking-scripted: restore bridge slaves dynamically added by…
This commit is contained in:
commit
8bcdb39a27
|
@ -288,6 +288,17 @@ let
|
||||||
${i}
|
${i}
|
||||||
'')}" > /run/${n}.interfaces
|
'')}" > /run/${n}.interfaces
|
||||||
|
|
||||||
|
${optionalString config.virtualisation.libvirtd.enable ''
|
||||||
|
# Enslave dynamically added interfaces which may be lost on nixos-rebuild
|
||||||
|
for uri in qemu:///system lxc:///; do
|
||||||
|
for dom in $(${pkgs.libvirt}/bin/virsh -c $uri list --name); do
|
||||||
|
${pkgs.libvirt}/bin/virsh -c $uri dumpxml "$dom" | \
|
||||||
|
${pkgs.xmlstarlet}/bin/xmlstarlet sel -t -m "//domain/devices/interface[@type='bridge'][source/@bridge='${n}'][target/@dev]" -v "concat('ip link set ',target/@dev,' master ',source/@bridge,';')" | \
|
||||||
|
${pkgs.bash}/bin/bash
|
||||||
|
done
|
||||||
|
done
|
||||||
|
''}
|
||||||
|
|
||||||
# Enable stp on the interface
|
# Enable stp on the interface
|
||||||
${optionalString v.rstp ''
|
${optionalString v.rstp ''
|
||||||
echo 2 >/sys/class/net/${n}/bridge/stp_state
|
echo 2 >/sys/class/net/${n}/bridge/stp_state
|
||||||
|
|
Loading…
Reference in New Issue