1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 13:41:26 +00:00

support lxc:/// and ignore weird bridges (like openvswitch)

This commit is contained in:
Volth 2017-08-01 10:30:58 +00:00
parent 10cbb52ae7
commit d48b12c27c

View file

@ -253,8 +253,12 @@ let
${optionalString config.virtualisation.libvirtd.enable ''
# Enslave dynamically added interfaces which may be lost on nixos-rebuild
for dom in $(${pkgs.libvirt}/bin/virsh list --name); do
${pkgs.libvirt}/bin/virsh dumpxml "$dom" | ${pkgs.xmlstarlet}/bin/xmlstarlet sel -t -m "//domain/devices/interface[@type='bridge']" -v "concat('ip link set ',target/@dev,' master ',source/@bridge)" | ${pkgs.bash}/bin/bash
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'][target/@dev][source/@bridge]" -v "concat('ip link set ',target/@dev,' master ',source/@bridge)" | \
${pkgs.bash}/bin/bash
done
done
''}