libvirtd service: Move mutable configs to /var
Modifies libvirt package to search for configs in /var/lib and changes libvirtd service to copy the default configs to the new location. This enables the user to change e.g. the networking configuration with virsh or virt-manager and keep those settings.
This commit is contained in:
parent
c29df5f8a7
commit
bce59a1a8b
@ -122,18 +122,14 @@ in
|
|||||||
chmod 755 /var/lib/libvirt
|
chmod 755 /var/lib/libvirt
|
||||||
chmod 755 /var/lib/libvirt/dnsmasq
|
chmod 755 /var/lib/libvirt/dnsmasq
|
||||||
|
|
||||||
# Libvirt unfortunately writes mutable state (such as
|
# Copy default libvirt network config .xml files to /var/lib
|
||||||
# runtime changes to VM, network or filter configurations)
|
# Files modified by the user will not be overwritten
|
||||||
# to /etc. So we can't use environment.etc to make the
|
for i in $(cd ${pkgs.libvirt}/var/lib && echo \
|
||||||
# default network and filter definitions available, since
|
|
||||||
# libvirt will then modify the originals in the Nix store.
|
|
||||||
# So here we copy them instead. Ugly.
|
|
||||||
for i in $(cd ${pkgs.libvirt}/etc && echo \
|
|
||||||
libvirt/qemu/networks/*.xml libvirt/qemu/networks/autostart/*.xml \
|
libvirt/qemu/networks/*.xml libvirt/qemu/networks/autostart/*.xml \
|
||||||
libvirt/nwfilter/*.xml );
|
libvirt/nwfilter/*.xml );
|
||||||
do
|
do
|
||||||
mkdir -p /etc/$(dirname $i) -m 755
|
mkdir -p /var/lib/$(dirname $i) -m 755
|
||||||
cp -fpd ${pkgs.libvirt}/etc/$i /etc/$i
|
cp -npd ${pkgs.libvirt}/var/lib/$i /var/lib/$i
|
||||||
done
|
done
|
||||||
|
|
||||||
# libvirtd puts the full path of the emulator binary in the machine
|
# libvirtd puts the full path of the emulator binary in the machine
|
||||||
|
@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"--localstatedir=/var"
|
"--localstatedir=/var"
|
||||||
"--sysconfdir=/etc"
|
"--sysconfdir=/var/lib"
|
||||||
"--with-libpcap"
|
"--with-libpcap"
|
||||||
"--with-vmware"
|
"--with-vmware"
|
||||||
"--with-vbox"
|
"--with-vbox"
|
||||||
@ -58,7 +58,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
installFlags = [
|
installFlags = [
|
||||||
"localstatedir=$(TMPDIR)/var"
|
"localstatedir=$(TMPDIR)/var"
|
||||||
"sysconfdir=$(out)/etc"
|
"sysconfdir=$(out)/var/lib"
|
||||||
];
|
];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user