Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

libvirt: 3.5.0 -> 3.6.0

Volth 84a6a368 f0f55ac6

+27 -26
+13 -21
nixos/modules/virtualisation/libvirtd.nix
··· 15 15 ''; 16 16 qemuConfigFile = pkgs.writeText "qemu.conf" '' 17 17 ${optionalString cfg.qemuOvmf '' 18 - nvram = ["${pkgs.OVMF.fd}/FV/OVMF_CODE.fd:${pkgs.OVMF.fd}/FV/OVMF_VARS.fd"] 18 + nvram = ["/run/libvirt/nix-ovmf/OVMF_CODE.fd:/run/libvirt/nix-ovmf/OVMF_VARS.fd"] 19 19 ''} 20 20 ${cfg.qemuVerbatimConfig} 21 21 ''; ··· 102 102 103 103 config = mkIf cfg.enable { 104 104 105 - environment.systemPackages = with pkgs; 106 - [ libvirt netcat-openbsd ] 107 - ++ optional cfg.enableKVM qemu_kvm; 105 + environment.systemPackages = with pkgs; [ libvirt netcat-openbsd ]; 108 106 109 107 boot.kernelModules = [ "tun" ]; 110 108 ··· 129 127 dnsmasq 130 128 ebtables 131 129 ] 132 - ++ optional cfg.enableKVM qemu_kvm 133 130 ++ optional vswitch.enable vswitch.package; 134 131 135 132 preStart = '' ··· 155 152 # Copy generated qemu config to libvirt directory 156 153 cp -f ${qemuConfigFile} /var/lib/libvirt/qemu.conf 157 154 158 - # libvirtd puts the full path of the emulator binary in the machine 159 - # config file. But this path can unfortunately be garbage collected 160 - # while still being used by the virtual machine. So update the 161 - # emulator path on each startup to something valid (re-scan $PATH). 162 - for file in /var/lib/libvirt/qemu/*.xml /var/lib/libvirt/lxc/*.xml; do 163 - test -f "$file" || continue 164 - # get (old) emulator path from config file 165 - emulator=$("${pkgs.xmlstarlet}/bin/xmlstarlet" select --template --value-of "/domain/devices/emulator" "$file") 166 - # get a (definitely) working emulator path by re-scanning $PATH 167 - new_emulator=$(PATH=${pkgs.libvirt}/libexec:$PATH command -v $(basename "$emulator")) 168 - # write back 169 - "${pkgs.xmlstarlet}/bin/xmlstarlet" edit --inplace --update "/domain/devices/emulator" -v "$new_emulator" "$file" 155 + # stable (not GC'able as in /nix/store) paths for using in <emulator> section of xml configs 156 + mkdir -p /run/libvirt/nix-emulators 157 + ln -s --force ${pkgs.libvirt}/libexec/libvirt_lxc /run/libvirt/nix-emulators/ 158 + ${optionalString pkgs.stdenv.isAarch64 "ln -s --force ${pkgs.qemu}/bin/qemu-system-aarch64 /run/libvirt/nix-emulators/"} 159 + ${optionalString cfg.enableKVM "ln -s --force ${pkgs.qemu_kvm}/bin/qemu-kvm /run/libvirt/nix-emulators/"} 170 160 171 - # Also refresh the OVMF path. Files with no matches are ignored. 172 - "${pkgs.xmlstarlet}/bin/xmlstarlet" edit --inplace --update "/domain/os/loader" -v "${pkgs.OVMF.fd}/FV/OVMF_CODE.fd" "$file" 173 - done 174 - ''; # */ 161 + ${optionalString cfg.qemuOvmf '' 162 + mkdir -p /run/libvirt/nix-ovmf 163 + ln -s --force ${pkgs.OVMF.fd}/FV/OVMF_CODE.fd /run/libvirt/nix-ovmf/ 164 + ln -s --force ${pkgs.OVMF.fd}/FV/OVMF_VARS.fd /run/libvirt/nix-ovmf/ 165 + ''} 166 + ''; 175 167 176 168 serviceConfig = { 177 169 Type = "notify";
+12 -3
pkgs/development/libraries/libvirt/default.nix
··· 1 1 { stdenv, fetchurl, fetchpatch 2 2 , pkgconfig, makeWrapper 3 - , libxml2, gnutls, devicemapper, perl, python2, attr 3 + , coreutils, libxml2, gnutls, devicemapper, perl, python2, attr 4 4 , iproute, iptables, readline, lvm2, utillinux, systemd, libpciaccess, gettext 5 5 , libtasn1, ebtables, libgcrypt, yajl, pmutils, libcap_ng, libapparmor 6 6 , dnsmasq, libnl, libpcap, libxslt, xhtml1, numad, numactl, perlPackages ··· 12 12 # if you update, also bump pythonPackages.libvirt or it will break 13 13 stdenv.mkDerivation rec { 14 14 name = "libvirt-${version}"; 15 - version = "3.5.0"; 15 + version = "3.6.0"; 16 16 17 17 src = fetchurl { 18 18 url = "http://libvirt.org/sources/${name}.tar.xz"; 19 - sha256 = "05mm4xdw6g960rwvc9189nhxpm1vrilnmpl4h4m1lha11pivlqr9"; 19 + sha256 = "0gcyql5dp6j370kvik9hjhxirrg89m7l1q52yq0g75h7jpv9fb1s"; 20 20 }; 21 21 22 22 patches = [ ./build-on-bsd.patch ]; ··· 36 36 PATH=${stdenv.lib.makeBinPath [ iproute iptables ebtables lvm2 systemd ]}:$PATH 37 37 substituteInPlace configure \ 38 38 --replace 'as_dummy="/bin:/usr/bin:/usr/sbin"' 'as_dummy="${numad}/bin"' 39 + 40 + # the path to qemu-kvm will be stored in VM's .xml and .save files 41 + # do not use "''${qemu_kvm}/bin/qemu-kvm" to avoid bound VMs to particular qemu derivations 42 + substituteInPlace src/qemu/qemu_capabilities.c \ 43 + --replace '"/usr/libexec/qemu-kvm"' '"/run/libvirt/nix-emulators/${if stdenv.isAarch64 then "qemu-system-aarch64" else "qemu-kvm"}"' 44 + substituteInPlace src/lxc/lxc_conf.c \ 45 + --replace 'lxc_path,' '"/run/libvirt/nix-emulators/libvirt_lxc",' 39 46 '' + '' 40 47 PATH=${dnsmasq}/bin:$PATH 41 48 patchShebangs . # fixes /usr/bin/python references ··· 77 84 --replace "lock/subsys" "lock" 78 85 sed -e "/gettext\.sh/a \\\n# Added in nixpkgs:\ngettext() { \"${gettext}/bin/gettext\" \"\$@\"; }" \ 79 86 -i "$out/libexec/libvirt-guests.sh" 87 + 88 + substituteInPlace $out/lib/systemd/system/libvirtd.service --replace /bin/kill ${coreutils}/bin/kill 80 89 '' + optionalString stdenv.isLinux '' 81 90 rm $out/lib/systemd/system/{virtlockd,virtlogd}.* 82 91 wrapProgram $out/sbin/libvirtd \
+2 -2
pkgs/top-level/python-packages.nix
··· 26512 26512 }; 26513 26513 26514 26514 libvirt = let 26515 - version = "3.5.0"; 26515 + version = "3.6.0"; 26516 26516 in assert version == pkgs.libvirt.version; pkgs.stdenv.mkDerivation rec { 26517 26517 name = "libvirt-python-${version}"; 26518 26518 26519 26519 src = pkgs.fetchurl { 26520 26520 url = "http://libvirt.org/sources/python/${name}.tar.gz"; 26521 - sha256 = "06mc0cm4k90z8vxaslk3ifpajg8w8dvm0m2mxwcd6fdzps8fwpsw"; 26521 + sha256 = "1l0s9cx38qb6x5xj32r531xap11m93c3gag30idj8fzkn74cpfgc"; 26522 26522 }; 26523 26523 26524 26524 buildInputs = with self; [ python pkgs.pkgconfig pkgs.libvirt lxml ];