Author: eelco
Date: Thu Apr 19 15:12:55 2012
New Revision: 33844
URL: https://nixos.org/websvn/nix/?rev=33844&sc=1

Log:
* Only stop libvirt-guests automatically on system shutdown. 
  Saving/restoring VMs is disruptive.

Modified:
   nixos/trunk/modules/virtualisation/libvirtd.nix

Modified: nixos/trunk/modules/virtualisation/libvirtd.nix
==============================================================================
--- nixos/trunk/modules/virtualisation/libvirtd.nix     Thu Apr 19 15:11:58 
2012        (r33843)
+++ nixos/trunk/modules/virtualisation/libvirtd.nix     Thu Apr 19 15:12:55 
2012        (r33844)
@@ -53,6 +53,7 @@
       { description = "Libvirtd virtual machine management daemon";
 
         startOn = "stopped udevtrigger";
+        stopOn = "";
 
         path =
           [ pkgs.bridge_utils pkgs.dmidecode pkgs.dnsmasq
@@ -98,16 +99,15 @@
       };
 
     # !!! Split this into save and restore tasks.
-    jobs.libvirt_guests =
-      { name = "libvirt-guests";
-
-        description = "Job to save/restore libvirtd VMs";
+    jobs."libvirt-guests" =
+      { description = "Job to save/restore libvirtd VMs";
 
         startOn = "started libvirtd";
 
         # We want to suspend VMs only on shutdown, but Upstart is broken.
-        #stopOn = "starting shutdown and stopping libvirtd";
-        stopOn = "stopping libvirtd";
+        stopOn = "";
+
+        restartIfChanged = false;
 
         path = [ pkgs.gettext pkgs.libvirt pkgs.gawk ];
 
@@ -122,6 +122,18 @@
         respawn = false;
       };
 
+    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
+          '';
+      };
+
   };
 
 }
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to