git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #81161 from wedens/libvirt-6.0.0

libvirt: 5.4.0 -> 6.1.0

commitd6fa6426088f377dca81af1526c0154789850bc7 authorRobin Gloster <mail@glob.in> dateMon 30 Mar 2020, 13:19 (7 years ago) parentd8c21cbb80edca
9 files changed+204−54
nixos/modules/tasks/network-interfaces-scripted.nix+12−6 nixos/modules/virtualisation/libvirtd.nix+7−4 pkgs/development/libraries/libvirt/5.9.0.nix+136 pkgs/development/libraries/libvirt/default.nix+12−38 pkgs/development/python-modules/libvirt/5.9.0.nix+27 pkgs/development/python-modules/libvirt/default.nix+2−2 pkgs/top-level/all-packages.nix+1 pkgs/top-level/perl-packages.nix+2−2 pkgs/top-level/python-packages.nix+5−2
nixos/modules/tasks/network-interfaces-scripted.nix+12−6
@@ -291,13 +291,19 @@ let
291291
292292 ${optionalString config.virtualisation.libvirtd.enable ''
293293 # Enslave dynamically added interfaces which may be lost on nixos-rebuild
294− for uri in qemu:///system lxc:///; do
295− for dom in $(${pkgs.libvirt}/bin/virsh -c $uri list --name); do
296− ${pkgs.libvirt}/bin/virsh -c $uri dumpxml "$dom" | \
297− ${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,';')" | \
298− ${pkgs.bash}/bin/bash
294+ #
295+ # 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.
296+ # `libvirtd.service` will set up bridge interfaces when it will start normally.
297+ #
298+ if ${pkgs.systemd}/bin/systemctl --quiet is-active 'libvirtd.service'; then
299+ for uri in qemu:///system lxc:///; do
300+ for dom in $(${pkgs.libvirt}/bin/virsh -c $uri list --name); do
301+ ${pkgs.libvirt}/bin/virsh -c $uri dumpxml "$dom" | \
302+ ${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,';')" | \
303+ ${pkgs.bash}/bin/bash
304+ done
299305 done
300− done
306+ fi
301307 ''}
302308
303309 # Enable stp on the interface
nixos/modules/virtualisation/libvirtd.nix+7−4
@@ -214,14 +214,14 @@ in {
214214 };
215215
216216 systemd.services.libvirtd = {
217− description = "Libvirt Virtual Machine Management Daemon";
218−
219− wantedBy = [ "multi-user.target" ];
220217 requires = [ "libvirtd-config.service" ];
221218 after = [ "systemd-udev-settle.service" "libvirtd-config.service" ]
222219 ++ optional vswitch.enable "ovs-vswitchd.service";
223220
224− environment.LIBVIRTD_ARGS = ''--config "${configFile}" ${concatStringsSep " " cfg.extraOptions}'';
221+ environment.LIBVIRTD_ARGS = escapeShellArgs (
222+ [ "--config" configFile
223+ "--timeout" "120" # from ${libvirt}/var/lib/sysconfig/libvirtd
224+ ] ++ cfg.extraOptions);
225225
226226 path = [ cfg.qemuPackage ] # libvirtd requires qemu-img to manage disk images
227227 ++ optional vswitch.enable vswitch.package;
@@ -266,5 +266,8 @@ in {
266266 serviceConfig.ExecStart = "@${pkgs.libvirt}/sbin/virtlockd virtlockd";
267267 restartIfChanged = false;
268268 };
269+
270+ systemd.sockets.libvirtd .wantedBy = [ "sockets.target" ];
271+ systemd.sockets.libvirtd-tcp.wantedBy = [ "sockets.target" ];
269272 };
270273}
pkgs/development/libraries/libvirt/5.9.0.nixnew file+136
@@ -0,0 +1,136 @@
1+{ stdenv, fetchurl, fetchgit
2+, pkgconfig, makeWrapper, libtool, autoconf, automake, fetchpatch
3+, coreutils, libxml2, gnutls, perl, python2, attr
4+, iproute, iptables, readline, lvm2, utillinux, systemd, libpciaccess, gettext
5+, libtasn1, ebtables, libgcrypt, yajl, pmutils, libcap_ng, libapparmor
6+, dnsmasq, libnl, libpcap, libxslt, xhtml1, numad, numactl, perlPackages
7+, curl, libiconv, gmp, zfs, parted, bridge-utils, dmidecode, glib
8+, enableXen ? false, xen ? null
9+, enableIscsi ? false, openiscsi
10+, enableCeph ? false, ceph
11+}:
12+
13+with stdenv.lib;
14+
15+# if you update, also bump <nixpkgs/pkgs/development/python-modules/libvirt/default.nix> and SysVirt in <nixpkgs/pkgs/top-level/perl-packages.nix>
16+let
17+ buildFromTarball = stdenv.isDarwin;
18+in stdenv.mkDerivation rec {
19+ pname = "libvirt";
20+ version = "5.9.0";
21+
22+ src =
23+ if buildFromTarball then
24+ fetchurl {
25+ url = "http://libvirt.org/sources/${pname}-${version}.tar.xz";
26+ sha256 = "0fc9jxw3v6x5hc10bkd7bbcayn24hbld5adj2gh5s648v7hx55il";
27+ }
28+ else
29+ fetchgit {
30+ url = git://libvirt.org/libvirt.git;
31+ rev = "v${version}";
32+ sha256 = "0smm77ag8bg24xkbhl4akqikjrsq2pd3wk31nj0hk1avqnl00gmk";
33+ fetchSubmodules = true;
34+ };
35+
36+ nativeBuildInputs = [ makeWrapper pkgconfig ];
37+ buildInputs = [
38+ libxml2 gnutls perl python2 readline gettext libtasn1 libgcrypt yajl
39+ libxslt xhtml1 perlPackages.XMLXPath curl libpcap glib
40+ ] ++ optionals (!buildFromTarball) [
41+ libtool autoconf automake
42+ ] ++ optionals stdenv.isLinux [
43+ libpciaccess lvm2 utillinux systemd libnl numad zfs
44+ libapparmor libcap_ng numactl attr parted
45+ ] ++ optionals (enableXen && stdenv.isLinux && stdenv.isx86_64) [
46+ xen
47+ ] ++ optionals enableIscsi [
48+ openiscsi
49+ ] ++ optionals enableCeph [
50+ ceph
51+ ] ++ optionals stdenv.isDarwin [
52+ libiconv gmp
53+ ];
54+
55+ preConfigure = ''
56+ ${ optionalString (!buildFromTarball) "./bootstrap --no-git --gnulib-srcdir=$(pwd)/.gnulib" }
57+ PATH=${stdenv.lib.makeBinPath ([ dnsmasq ] ++ optionals stdenv.isLinux [ iproute iptables ebtables lvm2 systemd numad ] ++ optionals enableIscsi [ openiscsi ])}:$PATH
58+ # the path to qemu-kvm will be stored in VM's .xml and .save files
59+ # do not use "''${qemu_kvm}/bin/qemu-kvm" to avoid bound VMs to particular qemu derivations
60+ substituteInPlace src/lxc/lxc_conf.c \
61+ --replace 'lxc_path,' '"/run/libvirt/nix-emulators/libvirt_lxc",'
62+ patchShebangs . # fixes /usr/bin/python references
63+ '';
64+
65+ configureFlags = [
66+ "--localstatedir=/var"
67+ "--sysconfdir=/var/lib"
68+ "--with-libpcap"
69+ "--with-qemu"
70+ "--with-vmware"
71+ "--with-vbox"
72+ "--with-test"
73+ "--with-esx"
74+ "--with-remote"
75+ ] ++ optionals stdenv.isLinux [
76+ "QEMU_BRIDGE_HELPER=/run/wrappers/bin/qemu-bridge-helper"
77+ "QEMU_PR_HELPER=/run/libvirt/nix-helpers/qemu-pr-helper"
78+ "EBTABLES_PATH=${ebtables}/bin/ebtables-legacy"
79+ "--with-attr"
80+ "--with-apparmor"
81+ "--with-secdriver-apparmor"
82+ "--with-numad"
83+ "--with-macvtap"
84+ "--with-virtualport"
85+ "--with-storage-disk"
86+ ] ++ optionals (stdenv.isLinux && zfs != null) [
87+ "--with-storage-zfs"
88+ ] ++ optionals enableIscsi [
89+ "--with-storage-iscsi"
90+ ] ++ optionals enableCeph [
91+ "--with-storage-rbd"
92+ ] ++ optionals stdenv.isDarwin [
93+ "--with-init-script=none"
94+ ];
95+
96+ installFlags = [
97+ "localstatedir=$(TMPDIR)/var"
98+ "sysconfdir=$(out)/var/lib"
99+ ];
100+
101+
102+ postInstall = let
103+ binPath = [ iptables iproute pmutils numad numactl bridge-utils dmidecode dnsmasq ebtables ] ++ optionals enableIscsi [ openiscsi ];
104+ in ''
105+ substituteInPlace $out/libexec/libvirt-guests.sh \
106+ --replace 'ON_BOOT=start' 'ON_BOOT=''${ON_BOOT:-start}' \
107+ --replace 'ON_SHUTDOWN=suspend' 'ON_SHUTDOWN=''${ON_SHUTDOWN:-suspend}' \
108+ --replace "$out/bin" '${gettext}/bin' \
109+ --replace 'lock/subsys' 'lock' \
110+ --replace 'gettext.sh' 'gettext.sh
111+ # Added in nixpkgs:
112+ gettext() { "${gettext}/bin/gettext" "$@"; }
113+ '
114+ '' + optionalString stdenv.isLinux ''
115+ substituteInPlace $out/lib/systemd/system/libvirtd.service --replace /bin/kill ${coreutils}/bin/kill
116+ rm $out/lib/systemd/system/{virtlockd,virtlogd}.*
117+ wrapProgram $out/sbin/libvirtd \
118+ --prefix PATH : /run/libvirt/nix-emulators:${makeBinPath binPath}
119+ '';
120+
121+ enableParallelBuilding = true;
122+
123+ NIX_CFLAGS_COMPILE = "-fno-stack-protector";
124+
125+ meta = {
126+ homepage = http://libvirt.org/;
127+ repositories.git = git://libvirt.org/libvirt.git;
128+ description = ''
129+ A toolkit to interact with the virtualization capabilities of recent
130+ versions of Linux (and other OSes)
131+ '';
132+ license = licenses.lgpl2Plus;
133+ platforms = platforms.unix;
134+ maintainers = with maintainers; [ fpletz globin ];
135+ };
136+}
pkgs/development/libraries/libvirt/default.nix+12−38
@@ -1,6 +1,6 @@
11{ stdenv, fetchurl, fetchgit
2−, pkgconfig, makeWrapper, libtool, autoconf, automake, fetchpatch
3−, coreutils, libxml2, gnutls, perl, python2, attr
2+, pkgconfig, makeWrapper, autoreconfHook, fetchpatch
3+, coreutils, libxml2, gnutls, perl, python2, attr, glib, docutils
44, iproute, iptables, readline, lvm2, utillinux, systemd, libpciaccess, gettext
55, libtasn1, ebtables, libgcrypt, yajl, pmutils, libcap_ng, libapparmor
66, dnsmasq, libnl, libpcap, libxslt, xhtml1, numad, numactl, perlPackages
@@ -17,52 +17,26 @@ let
1717 buildFromTarball = stdenv.isDarwin;
1818in stdenv.mkDerivation rec {
1919 pname = "libvirt";
20− version = "5.4.0";
20+ version = "6.1.0";
2121
2222 src =
2323 if buildFromTarball then
2424 fetchurl {
2525 url = "http://libvirt.org/sources/${pname}-${version}.tar.xz";
26− sha256 = "0ywf8m9yz2hxnic7fylzlmgy4m353r4vv5zsvp89zq5yh4h81yhw";
26+ sha256 = "1h7bmd7zgl64mwnxx4ji8l0mqmcbfxsx6kp1scyyfq2mwidihz0n";
2727 }
2828 else
2929 fetchgit {
3030 url = git://libvirt.org/libvirt.git;
3131 rev = "v${version}";
32− sha256 = "1dja1mf295w0sl83zag62c4j55cfbzzfbhdxpkyv2zm3zv0mwdyc";
32+ sha256 = "18sr3jvpxn45c4vrjzpa4qgnnfxxh95v6l6qk31zka3siv8rrwqx";
3333 fetchSubmodules = true;
3434 };
3535
36− patches = optionals (!stdenv.isDarwin) [
37− (fetchpatch {
38− name = "5.4.0-CVE-2019-10161.patch";
39− url = "https://libvirt.org/git/?p=libvirt.git;a=patch;h=aed6a032cead4386472afb24b16196579e239580";
40− sha256 = "19k9z9xx68nf03igbgy1imxnlp5ppj7cgdbq9kri3s834hkjcygs";
41− })
42− ] ++ [
43− (fetchpatch {
44− name = "5.4.0-CVE-2019-10166.patch";
45− url = "https://libvirt.org/git/?p=libvirt.git;a=patch;h=db0b78457f183e4c7ac45bc94de86044a1e2056a";
46− sha256 = "17pd1rab2mxj4q0vg30vi2gh78mf52ik1p5l12wrghb0wjf7swml";
47− })
48− (fetchpatch {
49− name = "5.4.0-CVE-2019-10167.patch";
50− url = "https://libvirt.org/git/?p=libvirt.git;a=patch;h=8afa68bac0cf99d1f8aaa6566685c43c22622f26";
51− sha256 = "0hgbwk0y2n6ihzjk8vqabhw914axjqgzcb7c5xx893r86c54c0ml";
52− })
53− (fetchpatch {
54− name = "5.4.0-CVE-2019-10168.patch";
55− url = "https://libvirt.org/git/?p=libvirt.git;a=patch;h=bf6c2830b6c338b1f5699b095df36f374777b291";
56− sha256 = "0s4hc3hsjncx1852ndjas1nng9v23pxf4mi1jxcajsqvhw89la0g";
57− })
58− ];
59−
60− nativeBuildInputs = [ makeWrapper pkgconfig ];
36+ nativeBuildInputs = [ makeWrapper pkgconfig docutils ] ++ optionals (!buildFromTarball) [ autoreconfHook ];
6137 buildInputs = [
6238 libxml2 gnutls perl python2 readline gettext libtasn1 libgcrypt yajl
63− libxslt xhtml1 perlPackages.XMLXPath curl libpcap
64− ] ++ optionals (!buildFromTarball) [
65− libtool autoconf automake
39+ libxslt xhtml1 perlPackages.XMLXPath curl libpcap glib
6640 ] ++ optionals stdenv.isLinux [
6741 libpciaccess lvm2 utillinux systemd libnl numad zfs
6842 libapparmor libcap_ng numactl attr parted
@@ -77,18 +51,19 @@ in stdenv.mkDerivation rec {
7751 ];
7852
7953 preConfigure = ''
80− ${ optionalString (!buildFromTarball) "./bootstrap --no-git --gnulib-srcdir=$(pwd)/.gnulib" }
81−
8254 PATH=${stdenv.lib.makeBinPath ([ dnsmasq ] ++ optionals stdenv.isLinux [ iproute iptables ebtables lvm2 systemd numad ] ++ optionals enableIscsi [ openiscsi ])}:$PATH
83−
8455 # the path to qemu-kvm will be stored in VM's .xml and .save files
8556 # do not use "''${qemu_kvm}/bin/qemu-kvm" to avoid bound VMs to particular qemu derivations
8657 substituteInPlace src/lxc/lxc_conf.c \
8758 --replace 'lxc_path,' '"/run/libvirt/nix-emulators/libvirt_lxc",'
88−
8959 patchShebangs . # fixes /usr/bin/python references
60+ mkdir -p build && cd build
9061 '';
9162
63+ configureScript = "../configure";
64+
65+ dontAddDisableDepTrack = true;
66+
9267 configureFlags = [
9368 "--localstatedir=/var"
9469 "--sysconfdir=/var/lib"
@@ -125,7 +100,6 @@ in stdenv.mkDerivation rec {
125100 "sysconfdir=$(out)/var/lib"
126101 ];
127102
128−
129103 postInstall = let
130104 binPath = [ iptables iproute pmutils numad numactl bridge-utils dmidecode dnsmasq ebtables ] ++ optionals enableIscsi [ openiscsi ];
131105 in ''
pkgs/development/python-modules/libvirt/5.9.0.nixnew file+27
@@ -0,0 +1,27 @@
1+{ stdenv, buildPythonPackage, fetchgit, pkgconfig, lxml, libvirt, nose }:
2+
3+buildPythonPackage rec {
4+ pname = "libvirt";
5+ version = "5.9.0";
6+
7+ src = fetchgit {
8+ url = git://libvirt.org/libvirt-python.git;
9+ rev = "v${version}";
10+ sha256 = "0qvr0s7yasswy1s5cvkm91iifk33pb8s7nbb38zznc46706b358r";
11+ };
12+
13+ nativeBuildInputs = [ pkgconfig ];
14+ buildInputs = [ libvirt lxml ];
15+
16+ checkInputs = [ nose ];
17+ checkPhase = ''
18+ nosetests
19+ '';
20+
21+ meta = with stdenv.lib; {
22+ homepage = http://www.libvirt.org/;
23+ description = "libvirt Python bindings";
24+ license = licenses.lgpl2;
25+ maintainers = [ maintainers.fpletz ];
26+ };
27+}
pkgs/development/python-modules/libvirt/default.nix+2−2
@@ -2,12 +2,12 @@
22
33buildPythonPackage rec {
44 pname = "libvirt";
5− version = "5.4.0";
5+ version = "6.1.0";
66
77 src = assert version == libvirt.version; fetchgit {
88 url = git://libvirt.org/libvirt-python.git;
99 rev = "v${version}";
10− sha256 = "0ja35z90i3m7vsjfpzfm7awkmja3h0150376i5pzmf2q8vp61fi5";
10+ sha256 = "0h3w1p5y4kg2hdbhxmg4lphcnmr7979iwi0m750f8vzbfccsrp7k";
1111 };
1212
1313 nativeBuildInputs = [ pkgconfig ];
pkgs/top-level/all-packages.nix+1
@@ -13324,6 +13324,7 @@ in
1332413324 libversion = callPackage ../development/libraries/libversion { };
1332513325
1332613326 libvirt = callPackage ../development/libraries/libvirt { };
13327+ libvirt_5_9_0 = callPackage ../development/libraries/libvirt/5.9.0.nix { };
1332713328
1332813329 libvirt-glib = callPackage ../development/libraries/libvirt-glib { };
1332913330
pkgs/top-level/perl-packages.nix+2−2
@@ -17358,11 +17358,11 @@ let
1735817358
1735917359 SysVirt = buildPerlModule rec {
1736017360 pname = "Sys-Virt";
17361− version = "5.4.0";
17361+ version = "6.1.0";
1736217362 src = assert version == pkgs.libvirt.version; pkgs.fetchgit {
1736317363 url = git://libvirt.org/libvirt-perl.git;
1736417364 rev = "v${version}";
17365− sha256 = "0csg10mydcif2l0qf16nlphq6ih5378nk6dk1vznf5bspws2ch7a";
17365+ sha256 = "00w4fmki7ff7i9bi39w2w15mvv38b5ifwk3zib90ny536r3n63sb";
1736617366 };
1736717367 nativeBuildInputs = [ pkgs.pkgconfig ];
1736817368 buildInputs = [ pkgs.libvirt CPANChanges TestPod TestPodCoverage XMLXPath ];
pkgs/top-level/python-packages.nix+5−2
@@ -6445,9 +6445,12 @@ in {
64456445 inherit (pkgs) libversion pkgconfig;
64466446 };
64476447
6448− libvirt = callPackage ../development/python-modules/libvirt {
6448+ libvirt = if isPy3k then (callPackage ../development/python-modules/libvirt {
64496449 inherit (pkgs) libvirt pkgconfig;
6450− };
6450+ }) else (callPackage ../development/python-modules/libvirt/5.9.0.nix {
6451+ inherit (pkgs) pkgconfig;
6452+ libvirt = pkgs.libvirt_5_9_0;
6453+ });
64516454
64526455 rpdb = callPackage ../development/python-modules/rpdb { };
64536456