diff options
author | Bjørn Forsman <bjorn.forsman@gmail.com> | 2014-09-15 23:03:20 +0200 |
---|---|---|
committer | Bjørn Forsman <bjorn.forsman@gmail.com> | 2014-09-15 23:03:20 +0200 |
commit | 0bfd27535f7f646dcb99963ad05bd93eb0c55b03 (patch) | |
tree | 716c05c930919717804385d20f5ad0baf68daecb /nixos/modules | |
parent | 3e5bcdc327eb0347e15ffe2072b2b61f80218d32 (diff) | |
download | nixlib-0bfd27535f7f646dcb99963ad05bd93eb0c55b03.tar nixlib-0bfd27535f7f646dcb99963ad05bd93eb0c55b03.tar.gz nixlib-0bfd27535f7f646dcb99963ad05bd93eb0c55b03.tar.bz2 nixlib-0bfd27535f7f646dcb99963ad05bd93eb0c55b03.tar.lz nixlib-0bfd27535f7f646dcb99963ad05bd93eb0c55b03.tar.xz nixlib-0bfd27535f7f646dcb99963ad05bd93eb0c55b03.tar.zst nixlib-0bfd27535f7f646dcb99963ad05bd93eb0c55b03.zip |
nixos/libvirtd: refresh LXC emulator path on startup
This fixes the issue when the LXC emulator binary is garbage collected and breaks libvirtd containers, because libvirtd XML file still refers to GC'ed store path. We already have a fix for QEMU, this commit extends the fix to cover LXC too.
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/virtualisation/libvirtd.nix | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix index 318460f4c2cf..2d03f0544b67 100644 --- a/nixos/modules/virtualisation/libvirtd.nix +++ b/nixos/modules/virtualisation/libvirtd.nix @@ -129,12 +129,12 @@ in # config file. But this path can unfortunately be garbage collected # while still being used by the virtual machine. So update the # emulator path on each startup to something valid (re-scan $PATH). - for file in /etc/libvirt/qemu/*.xml; do + for file in /etc/libvirt/qemu/*.xml /etc/libvirt/lxc/*.xml; do test -f "$file" || continue # get (old) emulator path from config file emulator=$(grep "^[[:space:]]*<emulator>" "$file" | sed 's,^[[:space:]]*<emulator>\(.*\)</emulator>.*,\1,') # get a (definitely) working emulator path by re-scanning $PATH - new_emulator=$(command -v $(basename "$emulator")) + new_emulator=$(PATH=${pkgs.libvirt}/libexec:$PATH command -v $(basename "$emulator")) # write back sed -i "s,^[[:space:]]*<emulator>.*, <emulator>$new_emulator</emulator> <!-- WARNING: emulator dirname is auto-updated by the nixos libvirtd module -->," "$file" done |