Update libvirt for systemd

This commit is contained in:
Eelco Dolstra 2012-10-26 16:21:35 +02:00
parent 23390147ea
commit 65eae4dd34

View File

@ -49,11 +49,11 @@ in
boot.kernelModules = [ "tun" ]; boot.kernelModules = [ "tun" ];
jobs.libvirtd = boot.systemd.services.libvirtd =
{ description = "Libvirtd virtual machine management daemon"; { description = "Libvirt Virtual Machine Management Daemon";
startOn = "stopped udevtrigger"; wantedBy = [ "multi-user.target" ];
stopOn = ""; after = [ "systemd-udev-settle.service" ];
path = path =
[ pkgs.bridge_utils pkgs.dmidecode pkgs.dnsmasq [ pkgs.bridge_utils pkgs.dmidecode pkgs.dnsmasq
@ -83,7 +83,9 @@ in
done done
''; # */ ''; # */
exec = "${pkgs.libvirt}/sbin/libvirtd --daemon --verbose"; serviceConfig.ExecStart = "@${pkgs.libvirt}/sbin/libvirtd libvirtd --daemon --verbose";
serviceConfig.Type = "forking";
serviceConfig.KillMode = "process"; # when stopping, leave the VMs alone
# Wait until libvirtd is ready to accept requests. # Wait until libvirtd is ready to accept requests.
postStart = postStart =
@ -94,18 +96,17 @@ in
done done
exit 1 # !!! seems to be ignored exit 1 # !!! seems to be ignored
''; '';
daemonType = "daemon";
}; };
# !!! Split this into save and restore tasks.
jobs."libvirt-guests" = jobs."libvirt-guests" =
{ description = "Job to save/restore libvirtd VMs"; { description = "Libvirt Virtual Machines";
startOn = "started libvirtd"; wantedBy = [ "multi-user.target" ];
wants = [ "libvirtd.service" ];
after = [ "libvirtd.service" ];
# We want to suspend VMs only on shutdown, but Upstart is broken. # We want to suspend VMs only on shutdown, but Upstart is broken.
stopOn = ""; #stopOn = "";
restartIfChanged = false; restartIfChanged = false;
@ -119,19 +120,8 @@ in
postStop = "${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests stop"; postStop = "${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests stop";
respawn = false; serviceConfig.Type = "oneshot";
}; serviceConfig.RemainAfterExit = true;
jobs."stop-libvirt" =
{ description = "Helper task to stop libvirtd and libvirt-guests on shutdown";
task = true;
restartIfChanged = false;
startOn = "starting shutdown";
script =
''
stop libvirt-guests || true
stop libvirtd || true
'';
}; };
}; };