Revert "Merge pull request #163714 from lovesegfault/libvirt-8.1.0"

This reverts commit cdd51022ab, reversing
changes made to 8db28de919.
This commit is contained in:
Bernardo Meurer 2022-03-12 14:24:01 -08:00
parent 968097b5c2
commit 316b6f84c2
No known key found for this signature in database
GPG key ID: F4C0D53B8D14C246
7 changed files with 500 additions and 491 deletions

View file

@ -0,0 +1,326 @@
From a896b0be849455edb83a9305dfec9b41447ef3e4 Mon Sep 17 00:00:00 2001
From: Euan Kemp <euank@euank.com>
Date: Thu, 14 Jan 2021 00:32:00 -0800
Subject: [PATCH] meson: patch in an install prefix for building on nix
Used in the nixpkgs version of libvirt so that we can install things in
the nix store, but read them from the root filesystem.
---
meson.build | 9 +++++++++
meson_options.txt | 2 ++
src/libxl/meson.build | 6 +++---
src/locking/meson.build | 8 ++++----
src/lxc/meson.build | 6 +++---
src/meson.build | 18 +++++++++---------
src/network/meson.build | 12 ++++++------
src/nwfilter/xml/meson.build | 2 +-
src/qemu/meson.build | 14 +++++++-------
src/remote/meson.build | 6 +++---
src/security/apparmor/meson.build | 8 ++++----
tools/meson.build | 4 ++--
12 files changed, 53 insertions(+), 42 deletions(-)
diff --git a/meson.build b/meson.build
index b5164f6..33719f1 100644
--- a/meson.build
+++ b/meson.build
@@ -39,6 +39,8 @@ if host_machine.system() == 'windows'
conf.set('WINVER', '0x0600') # Win Vista / Server 2008
endif
+# patched in for nix
+install_prefix = get_option('install_prefix')
# set various paths
@@ -57,6 +59,13 @@ else
sysconfdir = prefix / get_option('sysconfdir')
endif
+# nix: don't prefix the localstatedir; some things need to write to it, so it
+# can't be in the nix store, and that's what the prefix is.
+# We'll prefix things ourselves where needed
+localstatedir = get_option('localstatedir')
+# Same for sysconfidr
+sysconfdir = get_option('sysconfdir')
+
# if --prefix is /usr, don't use /usr/var for localstatedir or /usr/etc for
# sysconfdir as this makes a lot of things break in testing situations
if prefix == '/usr'
diff --git a/meson_options.txt b/meson_options.txt
index e5d79c2..081cd32 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,5 @@
+option('install_prefix', type: 'string', value: '', description: 'prefix for nix store installation')
+
option('no_git', type: 'boolean', value: false, description: 'Disable git submodule update')
option('packager', type: 'string', value: '', description: 'Extra packager name')
option('packager_version', type: 'string', value: '', description: 'Extra packager version')
diff --git a/src/libxl/meson.build b/src/libxl/meson.build
index 3bb6cc5..78d7be0 100644
--- a/src/libxl/meson.build
+++ b/src/libxl/meson.build
@@ -84,8 +84,8 @@ if conf.has('WITH_LIBXL')
}
virt_install_dirs += [
- localstatedir / 'lib' / 'libvirt' / 'libxl',
- runstatedir / 'libvirt' / 'libxl',
- localstatedir / 'log' / 'libvirt' / 'libxl',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'libxl',
+ install_prefix + runstatedir / 'libvirt' / 'libxl',
+ install_prefix + localstatedir / 'log' / 'libvirt' / 'libxl',
]
endif
diff --git a/src/locking/meson.build b/src/locking/meson.build
index 8a28310..9da81cc 100644
--- a/src/locking/meson.build
+++ b/src/locking/meson.build
@@ -243,14 +243,14 @@ if conf.has('WITH_LIBVIRTD')
}
virt_install_dirs += [
- localstatedir / 'lib' / 'libvirt' / 'lockd',
- localstatedir / 'lib' / 'libvirt' / 'lockd' / 'files',
- runstatedir / 'libvirt' / 'lockd',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'lockd',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'lockd' / 'files',
+ install_prefix + runstatedir / 'libvirt' / 'lockd',
]
if conf.has('WITH_SANLOCK')
virt_install_dirs += [
- localstatedir / 'lib' / 'libvirt' / 'sanlock',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'sanlock',
]
endif
endif
diff --git a/src/lxc/meson.build b/src/lxc/meson.build
index f8e2a88..96d6687 100644
--- a/src/lxc/meson.build
+++ b/src/lxc/meson.build
@@ -182,8 +182,8 @@ if conf.has('WITH_LXC')
}
virt_install_dirs += [
- localstatedir / 'lib' / 'libvirt' / 'lxc',
- runstatedir / 'libvirt' / 'lxc',
- localstatedir / 'log' / 'libvirt' / 'lxc',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'lxc',
+ install_prefix + runstatedir / 'libvirt' / 'lxc',
+ install_prefix + localstatedir / 'log' / 'libvirt' / 'lxc',
]
endif
diff --git a/src/meson.build b/src/meson.build
index 7c47821..d33d16a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -669,7 +669,7 @@ endforeach
virt_conf_files += 'libvirt.conf'
-install_data(virt_conf_files, install_dir: confdir)
+install_data(virt_conf_files, install_dir: install_prefix + confdir)
install_data(virt_aug_files, install_dir: virt_aug_dir)
# augeas_test_data:
@@ -729,7 +729,7 @@ foreach data : virt_daemon_confs
output: '@0@.conf'.format(data['name']),
configuration: daemon_conf,
install: true,
- install_dir: confdir,
+ install_dir: install_prefix + confdir,
)
if data.get('with_ip', false)
@@ -853,14 +853,14 @@ if conf.has('WITH_LIBVIRTD')
install_data(
init_file,
- install_dir: sysconfdir / 'init.d',
+ install_dir: install_prefix + sysconfdir / 'init.d',
rename: [ init['name'] ],
)
if init.has_key('confd')
install_data(
init['confd'],
- install_dir: sysconfdir / 'conf.d',
+ install_dir: install_prefix + sysconfdir / 'conf.d',
rename: [ init['name'] ],
)
endif
@@ -872,7 +872,7 @@ if init_script != 'none'
foreach sysconf : sysconf_files
install_data(
sysconf['file'],
- install_dir: sysconfdir / 'sysconfig',
+ install_dir: install_prefix + sysconfdir / 'sysconfig',
rename: [ sysconf['name'] ],
)
endforeach
@@ -897,10 +897,10 @@ endif
# Install empty directories
virt_install_dirs += [
- localstatedir / 'cache' / 'libvirt',
- localstatedir / 'lib' / 'libvirt' / 'images',
- localstatedir / 'lib' / 'libvirt' / 'filesystems',
- localstatedir / 'lib' / 'libvirt' / 'boot',
+ install_prefix + localstatedir / 'cache' / 'libvirt',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'images',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'filesystems',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'boot',
]
meson.add_install_script(
diff --git a/src/network/meson.build b/src/network/meson.build
index 3ec598c..b02040b 100644
--- a/src/network/meson.build
+++ b/src/network/meson.build
@@ -79,9 +79,9 @@ if conf.has('WITH_NETWORK')
}
virt_install_dirs += [
- localstatedir / 'lib' / 'libvirt' / 'network',
- localstatedir / 'lib' / 'libvirt' / 'dnsmasq',
- runstatedir / 'libvirt' / 'network',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'network',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'dnsmasq',
+ install_prefix + runstatedir / 'libvirt' / 'network',
]
configure_file(
@@ -89,12 +89,12 @@ if conf.has('WITH_NETWORK')
output: '@BASENAME@',
copy: true,
install: true,
- install_dir: confdir / 'qemu' / 'networks',
+ install_dir: install_prefix + confdir / 'qemu' / 'networks',
)
meson.add_install_script(
meson_python_prog.path(), python3_prog.path(), meson_install_symlink_prog.path(),
- confdir / 'qemu' / 'networks' / 'autostart',
+ install_prefix + confdir / 'qemu' / 'networks' / 'autostart',
'../default.xml', 'default.xml',
)
diff --git a/src/nwfilter/xml/meson.build b/src/nwfilter/xml/meson.build
index 0d96c54..66c92a1 100644
--- a/src/nwfilter/xml/meson.build
+++ b/src/nwfilter/xml/meson.build
@@ -25,4 +25,4 @@ nwfilter_xml_files = [
'qemu-announce-self.xml',
]
-install_data(nwfilter_xml_files, install_dir: sysconfdir / 'libvirt' / 'nwfilter')
+install_data(nwfilter_xml_files, install_dir: install_prefix + sysconfdir / 'libvirt' / 'nwfilter')
diff --git a/src/qemu/meson.build b/src/qemu/meson.build
index 90640b0..8802cec 100644
--- a/src/qemu/meson.build
+++ b/src/qemu/meson.build
@@ -171,12 +171,12 @@ if conf.has('WITH_QEMU')
}
virt_install_dirs += [
- localstatedir / 'lib' / 'libvirt' / 'qemu',
- runstatedir / 'libvirt' / 'qemu',
- localstatedir / 'cache' / 'libvirt' / 'qemu',
- localstatedir / 'log' / 'libvirt' / 'qemu',
- localstatedir / 'lib' / 'libvirt' / 'swtpm',
- runstatedir / 'libvirt' / 'qemu' / 'swtpm',
- localstatedir / 'log' / 'swtpm' / 'libvirt' / 'qemu',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'qemu',
+ install_prefix + runstatedir / 'libvirt' / 'qemu',
+ install_prefix + localstatedir / 'cache' / 'libvirt' / 'qemu',
+ install_prefix + localstatedir / 'log' / 'libvirt' / 'qemu',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'swtpm',
+ install_prefix + runstatedir / 'libvirt' / 'qemu' / 'swtpm',
+ install_prefix + localstatedir / 'log' / 'swtpm' / 'libvirt' / 'qemu',
]
endif
diff --git a/src/remote/meson.build b/src/remote/meson.build
index 9ad2f6a..429a15b 100644
--- a/src/remote/meson.build
+++ b/src/remote/meson.build
@@ -245,7 +245,7 @@ if conf.has('WITH_REMOTE')
}
virt_install_dirs += [
- localstatedir / 'log' / 'libvirt',
+ install_prefix + localstatedir / 'log' / 'libvirt',
]
logrotate_conf = configuration_data()
@@ -259,7 +259,7 @@ if conf.has('WITH_REMOTE')
)
install_data(
log_file,
- install_dir: sysconfdir / 'logrotate.d',
+ install_dir: install_prefix + sysconfdir / 'logrotate.d',
rename: [ name ],
)
endforeach
@@ -309,7 +309,7 @@ endif
if conf.has('WITH_SASL')
install_data(
'libvirtd.sasl',
- install_dir: sysconfdir / 'sasl2',
+ install_dir: install_prefix + sysconfdir / 'sasl2',
rename: [ 'libvirt.conf' ],
)
endif
diff --git a/src/security/apparmor/meson.build b/src/security/apparmor/meson.build
index af43780..e2d6c81 100644
--- a/src/security/apparmor/meson.build
+++ b/src/security/apparmor/meson.build
@@ -17,22 +17,22 @@ foreach name : apparmor_gen_profiles
output: name,
configuration: apparmor_gen_profiles_conf,
install: true,
- install_dir: apparmor_dir,
+ install_dir: install_prefix + apparmor_dir,
)
endforeach
install_data(
[ 'libvirt-qemu', 'libvirt-lxc' ],
- install_dir: apparmor_dir / 'abstractions',
+ install_dir: install_prefix + apparmor_dir / 'abstractions',
)
install_data(
[ 'TEMPLATE.qemu', 'TEMPLATE.lxc' ],
- install_dir: apparmor_dir / 'libvirt',
+ install_dir: install_prefix + apparmor_dir / 'libvirt',
)
install_data(
'usr.lib.libvirt.virt-aa-helper.local',
- install_dir: apparmor_dir / 'local',
+ install_dir: install_prefix + apparmor_dir / 'local',
rename: 'usr.lib.libvirt.virt-aa-helper',
)
diff --git a/tools/meson.build b/tools/meson.build
index b8c6802..dacd0ff 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -115,7 +115,7 @@ if conf.has('WITH_LOGIN_SHELL')
install_rpath: libvirt_rpath,
)
- install_data('virt-login-shell.conf', install_dir: sysconfdir / 'libvirt')
+ install_data('virt-login-shell.conf', install_dir: install_prefix + sysconfdir / 'libvirt')
endif
if host_machine.system() == 'windows'
@@ -274,7 +274,7 @@ configure_file(
if init_script == 'systemd'
install_data(
'libvirt-guests.sysconf',
- install_dir: sysconfdir / 'sysconfig',
+ install_dir: install_prefix + sysconfdir / 'sysconfig',
rename: 'libvirt-guests',
)

View file

@ -0,0 +1,14 @@
diff --git a/src/ch/meson.build b/src/ch/meson.build
index e34974d56c..4767763c2c 100644
--- a/src/ch/meson.build
+++ b/src/ch/meson.build
@@ -68,7 +68,7 @@ if conf.has('WITH_CH')
}
virt_install_dirs += [
- localstatedir / 'lib' / 'libvirt' / 'ch',
- runstatedir / 'libvirt' / 'ch',
+ install_prefix + localstatedir / 'lib' / 'libvirt' / 'ch',
+ install_prefix + runstatedir / 'libvirt' / 'ch',
]
endif

View file

@ -1,119 +1,85 @@
{ lib
, autoreconfHook
, bash-completion
, bridge-utils
, cmake
, coreutils
, curl
, darwin
, dbus
, dnsmasq
, docutils
, fetchFromGitLab
, stdenv
, fetchurl
, gettext
, glib
, fetchFromGitLab
, makeWrapper
, autoreconfHook
, fetchpatch
, coreutils
, libxml2
, gnutls
, perl
, python3
, attr
, glib
, docutils
, iproute2
, readline
, lvm2
, util-linux
, systemd
, libpciaccess
, gettext
, libtasn1
, iptables
, libgcrypt
, yajl
, pmutils
, libcap_ng
, libapparmor
, dnsmasq
, libnl
, libpcap
, libtasn1
, libxml2
, libxslt
, makeWrapper
, xhtml1
, numad
, numactl
, perlPackages
, curl
, libiconv
, gmp
, zfs
, parted
, bridge-utils
, dmidecode
, dbus
, libtirpc
, rpcsvc-proto
, darwin
, meson
, ninja
, perl
, perlPackages
, audit
, cmake
, bash-completion
, pkg-config
, pmutils
, python3
, readline
, rpcsvc-proto
, stdenv
, xhtml1
, yajl
# Linux
, acl ? null
, attr ? null
, audit ? null
, dmidecode ? null
, fuse ? null
, kmod ? null
, libapparmor ? null
, libcap_ng ? null
, libnl ? null
, libpciaccess ? null
, libtirpc ? null
, lvm2 ? null
, numactl ? null
, numad ? null
, parted ? null
, systemd ? null
, util-linux ? null
# Darwin
, gmp ? null
, libiconv ? null
, Carbon ? null
, AppKit ? null
# Options
, enableCeph ? false
, ceph ? null
, enableGlusterfs ? false
, glusterfs ? null
, enableIscsi ? false
, openiscsi ? null
, libiscsi ? null
, enableXen ? false
, xen ? null
, enableZfs ? stdenv.isLinux
, zfs ? null
, enableIscsi ? false
, openiscsi
, enableCeph ? false
, ceph
, enableGlusterfs ? false
, glusterfs
, Carbon
, AppKit
}:
with lib;
let
inherit (stdenv) isDarwin isLinux isx86_64;
binPath = makeBinPath ([
dnsmasq
] ++ optionals isLinux [
bridge-utils
dmidecode
dnsmasq
iproute2
iptables
kmod
lvm2
numactl
numad
pmutils
systemd
] ++ optionals enableIscsi [
libiscsi
openiscsi
]);
in
assert enableXen -> isLinux && isx86_64;
assert enableCeph -> isLinux;
assert enableGlusterfs -> isLinux;
assert enableZfs -> isLinux;
# if you update, also bump <nixpkgs/pkgs/development/python-modules/libvirt/default.nix> and SysVirt in <nixpkgs/pkgs/top-level/perl-packages.nix>
let
buildFromTarball = stdenv.isDarwin;
in
stdenv.mkDerivation rec {
pname = "libvirt";
version = "8.1.0";
version = "7.10.0";
src =
if isDarwin then
if buildFromTarball then
fetchurl
{
url = "https://libvirt.org/sources/${pname}-${version}.tar.xz";
sha256 = "sha256-PGxDvs/+s0o/OXxhYgaqaaiT/4v16CCDk8hOjnU1KTQ=";
sha256 = "sha256-yzGAFK8JcyeSjG49cpIuO+AqPmQBJHsqpS2auOC0gPk=";
}
else
fetchFromGitLab
@ -121,74 +87,76 @@ stdenv.mkDerivation rec {
owner = pname;
repo = pname;
rev = "v${version}";
sha256 = "sha256-nk8pBlss+g4EMy+RnAOyz6YlGGvlBvl5aBpcytsK1wY=";
sha256 = "sha256-bB8LsjZFeJbMmmC0YRPyMag2MBhwagUFC7aB1KhZEkA=";
fetchSubmodules = true;
};
patches = [
./do-not-use-sysconfig.patch
./qemu-segmentation-fault-in-virtqemud-executing-qemuD.patch
./0001-meson-patch-in-an-install-prefix-for-building-on-nix.patch
./0002-meson-patch-ch-install-prefix.patch
];
nativeBuildInputs = [
meson
cmake
docutils
makeWrapper
ninja
meson
cmake
makeWrapper
pkg-config
]
++ optional (!isDarwin) rpcsvc-proto
# NOTE: needed for rpcgen
++ optional isDarwin darwin.developer_cmds;
docutils
] ++ optional (!stdenv.isDarwin) [
rpcsvc-proto
] ++ optionals stdenv.isDarwin [
darwin.developer_cmds # needed for rpcgen
];
buildInputs = [
bash-completion
curl
dbus
gettext
glib
gnutls
libgcrypt
libpcap
libtasn1
libxml2
libxslt
perl
perlPackages.XMLXPath
pkg-config
libxml2
gnutls
perl
python3
readline
xhtml1
gettext
libtasn1
libgcrypt
yajl
] ++ optionals isLinux [
acl
attr
libxslt
xhtml1
perlPackages.XMLXPath
curl
libpcap
glib
dbus
] ++ optionals stdenv.isLinux [
audit
fuse
libpciaccess
lvm2
util-linux
systemd
libnl
numad
zfs
libapparmor
libcap_ng
libnl
libpciaccess
libtirpc
lvm2
numactl
numad
attr
parted
systemd
util-linux
] ++ optionals isDarwin [
AppKit
Carbon
gmp
libtirpc
] ++ optionals (enableXen && stdenv.isLinux && stdenv.isx86_64) [
xen
] ++ optionals enableIscsi [
openiscsi
] ++ optionals enableCeph [
ceph
] ++ optionals enableGlusterfs [
glusterfs
] ++ optionals stdenv.isDarwin [
libiconv
]
++ optionals enableCeph [ ceph ]
++ optionals enableGlusterfs [ glusterfs ]
++ optionals enableIscsi [ libiscsi openiscsi ]
++ optionals enableXen [ xen ]
++ optionals enableZfs [ zfs ];
gmp
Carbon
AppKit
];
preConfigure =
let
@ -196,118 +164,80 @@ stdenv.mkDerivation rec {
QEMU_BRIDGE_HELPER = "/run/wrappers/bin/qemu-bridge-helper";
QEMU_PR_HELPER = "/run/libvirt/nix-helpers/qemu-pr-helper";
};
patchBuilder = var: value: ''
sed -i meson.build -e "s|conf.set_quoted('${var}',.*|conf.set_quoted('${var}','${value}')|"
'';
in
''
PATH="${binPath}:$PATH"
PATH=${lib.makeBinPath ([ dnsmasq ] ++ optionals stdenv.isLinux [ iproute2 iptables lvm2 systemd numad ] ++ optionals enableIscsi [ openiscsi ])}:$PATH
# the path to qemu-kvm will be stored in VM's .xml and .save files
# do not use "''${qemu_kvm}/bin/qemu-kvm" to avoid bound VMs to particular qemu derivations
substituteInPlace src/lxc/lxc_conf.c \
--replace 'lxc_path,' '"/run/libvirt/nix-emulators/libvirt_lxc",'
substituteInPlace build-aux/meson.build \
--replace "gsed" "sed" \
--replace "gmake" "make" \
--replace "ggrep" "grep"
patchShebangs .
''
+ (lib.concatStringsSep "\n" (lib.mapAttrsToList patchBuilder overrides));
mesonAutoFeatures = "disabled";
mesonAutoFeatures = "auto";
mesonFlags =
let
cfg = option: val: "-D${option}=${val}";
feat = option: enable: cfg option (if enable then "enabled" else "disabled");
driver = name: feat "driver_${name}";
storage = name: feat "storage_${name}";
opt = option: enable: "-D${option}=${if enable then "enabled" else "disabled"}";
in
[
"--localstatedir=${placeholder "out"}/var/"
(cfg "init_script" (if isDarwin then "none" else "systemd"))
(feat "apparmor" isLinux)
(feat "attr" isLinux)
(feat "audit" isLinux)
(feat "bash_completion" true)
(feat "blkid" isLinux)
(feat "capng" isLinux)
(feat "curl" true)
(feat "docs" true)
(feat "expensive_tests" true)
(feat "firewalld" isLinux)
(feat "firewalld_zone" isLinux)
(feat "fuse" isLinux)
(feat "glusterfs" enableGlusterfs)
(feat "host_validate" true)
(feat "libiscsi" enableIscsi)
(feat "libnl" isLinux)
(feat "libpcap" true)
(feat "libssh2" true)
(feat "login_shell" isLinux)
(feat "nss" isLinux)
(feat "numactl" isLinux)
(feat "numad" isLinux)
(feat "pciaccess" isLinux)
(feat "polkit" true)
(feat "readline" true)
(feat "secdriver_apparmor" isLinux)
(feat "tests" true)
(feat "udev" isLinux)
(feat "yajl" true)
(driver "ch" isLinux)
(driver "esx" true)
(driver "interface" isLinux)
(driver "libvirtd" true)
(driver "libxl" enableXen)
(driver "lxc" isLinux)
(driver "network" true)
(driver "openvz" isLinux)
(driver "qemu" true)
(driver "remote" true)
(driver "secrets" true)
(driver "test" true)
(driver "vbox" true)
(driver "vmware" true)
(storage "dir" true)
(storage "disk" isLinux)
(storage "fs" isLinux)
(storage "gluster" enableGlusterfs)
(storage "iscsi" enableIscsi)
(storage "iscsi_direct" enableIscsi)
(storage "lvm" isLinux)
(storage "mpath" isLinux)
(storage "rbd" enableCeph)
(storage "scsi" true)
(storage "vstorage" isLinux)
(storage "zfs" enableZfs)
"--sysconfdir=/var/lib"
"-Dinstall_prefix=${placeholder "out"}"
"-Dlocalstatedir=/var"
"-Drunstatedir=/run"
"-Dlibpcap=enabled"
"-Ddriver_qemu=enabled"
"-Ddriver_vmware=enabled"
"-Ddriver_vbox=enabled"
"-Ddriver_test=enabled"
"-Ddriver_esx=enabled"
"-Ddriver_remote=enabled"
"-Dpolkit=enabled"
(opt "storage_iscsi" enableIscsi)
] ++ optionals stdenv.isLinux [
(opt "storage_zfs" (zfs != null))
"-Dattr=enabled"
"-Dapparmor=enabled"
"-Dsecdriver_apparmor=enabled"
"-Dnumad=enabled"
"-Dstorage_disk=enabled"
(opt "glusterfs" enableGlusterfs)
(opt "storage_rbd" enableCeph)
] ++ optionals stdenv.isDarwin [
"-Dinit_script=none"
];
postInstall = ''
substituteInPlace $out/bin/virt-xml-validate \
--replace xmllint ${libxml2}/bin/xmllint
postInstall =
let
binPath = [ iptables iproute2 pmutils numad numactl bridge-utils dmidecode dnsmasq ] ++ optionals enableIscsi [ openiscsi ];
in
''
substituteInPlace $out/bin/virt-xml-validate \
--replace xmllint ${libxml2}/bin/xmllint
substituteInPlace $out/libexec/libvirt-guests.sh \
--replace 'ON_BOOT="start"' 'ON_BOOT=''${ON_BOOT:-start}' \
--replace 'ON_SHUTDOWN="suspend"' 'ON_SHUTDOWN=''${ON_SHUTDOWN:-suspend}' \
--replace "$out/bin" '${gettext}/bin' \
--replace 'lock/subsys' 'lock' \
--replace 'gettext.sh' 'gettext.sh
# Added in nixpkgs:
gettext() { "${gettext}/bin/gettext" "$@"; }
'
'' + optionalString isLinux ''
substituteInPlace $out/lib/systemd/system/libvirtd.service --replace /bin/kill ${coreutils}/bin/kill
rm $out/lib/systemd/system/{virtlockd,virtlogd}.*
wrapProgram $out/sbin/libvirtd \
--prefix PATH : /run/libvirt/nix-emulators:${binPath}
'';
substituteInPlace $out/libexec/libvirt-guests.sh \
--replace 'ON_BOOT="start"' 'ON_BOOT=''${ON_BOOT:-start}' \
--replace 'ON_SHUTDOWN="suspend"' 'ON_SHUTDOWN=''${ON_SHUTDOWN:-suspend}' \
--replace "$out/bin" '${gettext}/bin' \
--replace 'lock/subsys' 'lock' \
--replace 'gettext.sh' 'gettext.sh
# Added in nixpkgs:
gettext() { "${gettext}/bin/gettext" "$@"; }
'
'' + optionalString stdenv.isLinux ''
substituteInPlace $out/lib/systemd/system/libvirtd.service --replace /bin/kill ${coreutils}/bin/kill
rm $out/lib/systemd/system/{virtlockd,virtlogd}.*
wrapProgram $out/sbin/libvirtd \
--prefix PATH : /run/libvirt/nix-emulators:${makeBinPath binPath}
'';
meta = {
homepage = "https://libvirt.org/";
@ -318,6 +248,6 @@ stdenv.mkDerivation rec {
'';
license = licenses.lgpl2Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ fpletz globin lovesegfault ];
maintainers = with maintainers; [ fpletz globin ];
};
}

View file

@ -1,211 +0,0 @@
From 10d65f10a76c7478c4ec0c65ffeec7f4b18929f9 Mon Sep 17 00:00:00 2001
Message-Id: <10d65f10a76c7478c4ec0c65ffeec7f4b18929f9.1646212419.git.mprivozn@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Wed, 2 Mar 2022 10:01:04 +0100
Subject: [PATCH] libvirt-8.2.0-do-not-use-sysconfig.patch
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/interface/virtinterfaced.service.in | 1 -
src/libxl/virtxend.service.in | 1 -
src/locking/virtlockd.service.in | 1 -
src/logging/virtlogd.service.in | 3 +--
src/lxc/virtlxcd.service.in | 1 -
src/network/virtnetworkd.service.in | 1 -
src/node_device/virtnodedevd.service.in | 1 -
src/nwfilter/virtnwfilterd.service.in | 1 -
src/qemu/virtqemud.service.in | 1 -
src/remote/libvirtd.service.in | 1 -
src/remote/virtproxyd.service.in | 1 -
src/secret/virtsecretd.service.in | 1 -
src/storage/virtstoraged.service.in | 1 -
src/vbox/virtvboxd.service.in | 1 -
tools/libvirt-guests.service.in | 2 +-
15 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/src/interface/virtinterfaced.service.in b/src/interface/virtinterfaced.service.in
index cb860ff1c4..090b198ac7 100644
--- a/src/interface/virtinterfaced.service.in
+++ b/src/interface/virtinterfaced.service.in
@@ -14,7 +14,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=VIRTINTERFACED_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtinterfaced
ExecStart=@sbindir@/virtinterfaced $VIRTINTERFACED_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
diff --git a/src/libxl/virtxend.service.in b/src/libxl/virtxend.service.in
index 6b083c414f..597f5d1905 100644
--- a/src/libxl/virtxend.service.in
+++ b/src/libxl/virtxend.service.in
@@ -19,7 +19,6 @@ ConditionPathExists=/proc/xen/capabilities
[Service]
Type=notify
Environment=VIRTXEND_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtxend
ExecStart=@sbindir@/virtxend $VIRTXEND_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in
index 19271d1e7d..87193952cb 100644
--- a/src/locking/virtlockd.service.in
+++ b/src/locking/virtlockd.service.in
@@ -8,7 +8,6 @@ Documentation=https://libvirt.org
[Service]
Environment=VIRTLOCKD_ARGS=
-EnvironmentFile=-@sysconfdir@/sysconfig/virtlockd
ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS
ExecReload=/bin/kill -USR1 $MAINPID
# Losing the locks is a really bad thing that will
diff --git a/src/logging/virtlogd.service.in b/src/logging/virtlogd.service.in
index 8ab5478517..fe5c58b8ed 100644
--- a/src/logging/virtlogd.service.in
+++ b/src/logging/virtlogd.service.in
@@ -7,8 +7,7 @@ Documentation=man:virtlogd(8)
Documentation=https://libvirt.org
[Service]
-EnvironmentFile=-@sysconfdir@/sysconfig/virtlogd
-ExecStart=@sbindir@/virtlogd $VIRTLOGD_ARGS
+ExecStart=@sbindir@/virtlogd
ExecReload=/bin/kill -USR1 $MAINPID
# Losing the logs is a really bad thing that will
# cause the machine to be fenced (rebooted), so make
diff --git a/src/lxc/virtlxcd.service.in b/src/lxc/virtlxcd.service.in
index 334c34db44..1b9689017e 100644
--- a/src/lxc/virtlxcd.service.in
+++ b/src/lxc/virtlxcd.service.in
@@ -19,7 +19,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=VIRTLXCD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtlxcd
ExecStart=@sbindir@/virtlxcd $VIRTLXCD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
diff --git a/src/network/virtnetworkd.service.in b/src/network/virtnetworkd.service.in
index 05ce672b73..ee4cd9bca1 100644
--- a/src/network/virtnetworkd.service.in
+++ b/src/network/virtnetworkd.service.in
@@ -17,7 +17,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=VIRTNETWORKD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtnetworkd
ExecStart=@sbindir@/virtnetworkd $VIRTNETWORKD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
diff --git a/src/node_device/virtnodedevd.service.in b/src/node_device/virtnodedevd.service.in
index cd9de362fd..7693aa52c4 100644
--- a/src/node_device/virtnodedevd.service.in
+++ b/src/node_device/virtnodedevd.service.in
@@ -14,7 +14,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=VIRTNODEDEVD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtnodedevd
ExecStart=@sbindir@/virtnodedevd $VIRTNODEDEVD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
diff --git a/src/nwfilter/virtnwfilterd.service.in b/src/nwfilter/virtnwfilterd.service.in
index ab65419e0c..16d8b377b0 100644
--- a/src/nwfilter/virtnwfilterd.service.in
+++ b/src/nwfilter/virtnwfilterd.service.in
@@ -14,7 +14,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=VIRTNWFILTERD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtnwfilterd
ExecStart=@sbindir@/virtnwfilterd $VIRTNWFILTERD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
diff --git a/src/qemu/virtqemud.service.in b/src/qemu/virtqemud.service.in
index 5ad968ace9..c63147d31f 100644
--- a/src/qemu/virtqemud.service.in
+++ b/src/qemu/virtqemud.service.in
@@ -21,7 +21,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=VIRTQEMUD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtqemud
ExecStart=@sbindir@/virtqemud $VIRTQEMUD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
index 5d4d412fcc..27cfc34b90 100644
--- a/src/remote/libvirtd.service.in
+++ b/src/remote/libvirtd.service.in
@@ -29,7 +29,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=LIBVIRTD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/libvirtd
ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
diff --git a/src/remote/virtproxyd.service.in b/src/remote/virtproxyd.service.in
index f9bb6b84a9..0eddf5ee93 100644
--- a/src/remote/virtproxyd.service.in
+++ b/src/remote/virtproxyd.service.in
@@ -14,7 +14,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=VIRTPROXYD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtproxyd
ExecStart=@sbindir@/virtproxyd $VIRTPROXYD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
diff --git a/src/secret/virtsecretd.service.in b/src/secret/virtsecretd.service.in
index 6d298c5334..92e54f175f 100644
--- a/src/secret/virtsecretd.service.in
+++ b/src/secret/virtsecretd.service.in
@@ -14,7 +14,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=VIRTSECRETD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtsecretd
ExecStart=@sbindir@/virtsecretd $VIRTSECRETD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
diff --git a/src/storage/virtstoraged.service.in b/src/storage/virtstoraged.service.in
index eda4d86d37..abe91e3d80 100644
--- a/src/storage/virtstoraged.service.in
+++ b/src/storage/virtstoraged.service.in
@@ -16,7 +16,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=VIRTSTORAGED_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtstoraged
ExecStart=@sbindir@/virtstoraged $VIRTSTORAGED_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
diff --git a/src/vbox/virtvboxd.service.in b/src/vbox/virtvboxd.service.in
index 6f447276e9..54fbd0be4a 100644
--- a/src/vbox/virtvboxd.service.in
+++ b/src/vbox/virtvboxd.service.in
@@ -15,7 +15,6 @@ Documentation=https://libvirt.org
[Service]
Type=notify
Environment=VIRTVBOXD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtvboxd
ExecStart=@sbindir@/virtvboxd $VIRTVBOXD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
index 3cf6476196..5668009ae4 100644
--- a/tools/libvirt-guests.service.in
+++ b/tools/libvirt-guests.service.in
@@ -20,7 +20,7 @@ Documentation=man:libvirt-guests(8)
Documentation=https://libvirt.org
[Service]
-EnvironmentFile=-@sysconfdir@/sysconfig/libvirt-guests
+EnvironmentFile=-/etc/libvirt/libvirt-guests.conf
# Hack just call traditional service until we factor
# out the code
ExecStart=@libexecdir@/libvirt-guests.sh start
--
2.34.1

View file

@ -1,50 +0,0 @@
From 823a62ec8aac4fb75e6e281164f3eb56ae47597c Mon Sep 17 00:00:00 2001
Message-Id: <823a62ec8aac4fb75e6e281164f3eb56ae47597c.1646211032.git.mprivozn@redhat.com>
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
Date: Tue, 1 Mar 2022 18:47:59 +0100
Subject: [PATCH] qemu: segmentation fault in virtqemud executing
qemuDomainUndefineFlags
Commit 5adfb3472342741c443ac91dee0abb18b5a3d038 causes a segmentation fault.
Stack trace of thread 664419:
#0 0x000003ff62ec553c in qemuDomainUndefineFlags (dom=0x3ff6c002810, flags=<optimized out>) at ../src/qemu/qemu_driver.c:6618
#1 0x000003ff876a7e5c in virDomainUndefineFlags (domain=domain@entry=0x3ff6c002810, flags=<optimized out>) at ../src/libvirt-domain.c:6519
#2 0x000002aa2b64a808 in remoteDispatchDomainUndefineFlags (server=0x2aa2c3d7880, msg=0x2aa2c3d2770, args=<optimized out>, rerr=0x3ff8287b950, client=<optimized out>)
at src/remote/remote_daemon_dispatch_stubs.h:13080
#3 remoteDispatchDomainUndefineFlagsHelper (server=0x2aa2c3d7880, client=<optimized out>, msg=0x2aa2c3d2770, rerr=0x3ff8287b950, args=<optimized out>, ret=0x0)
at src/remote/remote_daemon_dispatch_stubs.h:13059
#4 0x000003ff8758bbf4 in virNetServerProgramDispatchCall (msg=0x2aa2c3d2770, client=0x2aa2c3e3050, server=0x2aa2c3d7880, prog=0x2aa2c3d8010)
at ../src/rpc/virnetserverprogram.c:428
#5 virNetServerProgramDispatch (prog=0x2aa2c3d8010, server=server@entry=0x2aa2c3d7880, client=0x2aa2c3e3050, msg=0x2aa2c3d2770) at ../src/rpc/virnetserverprogram.c:302
#6 0x000003ff8758c260 in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x2aa2c3d7880) at ../src/rpc/virnetserver.c:140
#7 virNetServerHandleJob (jobOpaque=0x2aa2c3e2d30, opaque=0x2aa2c3d7880) at ../src/rpc/virnetserver.c:160
#8 0x000003ff874c49aa in virThreadPoolWorker (opaque=<optimized out>) at ../src/util/virthreadpool.c:164
#9 0x000003ff874c3f62 in virThreadHelper (data=<optimized out>) at ../src/util/virthread.c:256
#10 0x000003ff86c1cf8c in start_thread () from /lib64/libc.so.6
#11 0x000003ff86c9650e in thread_start () from /lib64/libc.so.6
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bcd9bdb436..8337eed510 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6615,7 +6615,7 @@ qemuDomainUndefineFlags(virDomainPtr dom,
}
}
- if (vm->def->os.loader->nvram) {
+ if (vm->def->os.loader && vm->def->os.loader->nvram) {
nvram_path = g_strdup(vm->def->os.loader->nvram);
} else if (vm->def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI) {
qemuDomainNVRAMPathFormat(cfg, vm->def, &nvram_path);
--
2.34.1

View file

@ -2,13 +2,13 @@
buildPythonPackage rec {
pname = "libvirt";
version = "8.1.0";
version = "7.10.0";
src = assert version == libvirt.version; fetchFromGitLab {
owner = "libvirt";
repo = "libvirt-python";
rev = "v${version}";
sha256 = "sha256-/uGxjptiqm5B823z4mcjredj9ZLZC2WTTqhQrQPVfDU=";
sha256 = "sha256-I1FNjNwWRyDAUSq2Co9EnjAbzKQtS0Rx8vHgPsFzSYw=";
};
nativeBuildInputs = [ pkg-config ];

View file

@ -20782,12 +20782,12 @@ let
SysVirt = buildPerlModule rec {
pname = "Sys-Virt";
version = "8.1.0";
version = "7.10.0";
src = fetchFromGitLab {
owner = "libvirt";
repo = "libvirt-perl";
rev = "v${version}";
sha256 = "sha256-9cjH4hIIxB+Pv9+ck6xg8KmfM8jtVFKVQNGLYr2AnAM=";
rev = "v7.10.0";
sha256 = "sha256-cXuzg4bBwCftdZhz3e50L+4fO0RWX5Tl8zDOoydECd4=";
};
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.libvirt CPANChanges TestPod TestPodCoverage XMLXPath ];